Newsgroups: comp.lang.c++ Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!stanford.edu!leland.Stanford.EDU!denisb From: denisb@leland.Stanford.EDU (Denis Bohm) Subject: Re: Public vs Private header files in C++ Message-ID: <1991Jun5.025457.4116@leland.Stanford.EDU> Organization: AIR, Stanford University References: <5243@servax0.essex.ac.uk> <18759@prometheus.megatest.UUCP> Date: Wed, 5 Jun 91 02:54:57 GMT Lines: 28 A very simple way to really make something private is to hide those private variables into a struct that is not defined in the public header file (this also lets you change the hidden state store in the class without having to recompile clients that use the class): foo.h: ------ class foo { struct foo_hidden* hidden; public: foo(); }; foo.c: ------ #include "foo.h" struct foo_hidden { int hidden_variable; }; foo:foo() { hidden = new struct foo_hidden; } Denis Bohm