Path: utzoo!attcan!uunet!husc6!ukma!gatech!cumulus!hsu From: hsu@cumulus (Yung-Kao Hsu) Newsgroups: comp.lang.c++ Subject: Re: Can we hide the private part of a class ? Keywords: header dependency, efficiency. Message-ID: <1369@cumulus> Date: 3 Oct 88 14:01:59 GMT References: <1368@cumulus> <10681@ulysses.homer.nj.att.com> Reply-To: hsu@cumulus.UUCP (Yung-Kao Hsu) Organization: Georgia Institute of Technology Lines: 34 In article <10681@ulysses.homer.nj.att.com> ekrell@hector.UUCP (Eduardo Krell) writes: >In article <1368@cumulus> hsu@cumulus.UUCP (Yung-Kao Hsu) writes: > >>The header dependency simply forces re-compilation of all program >>units if some private declarations were changed (which shouldn't cause any >>problem to any other classes). > >You can't really say that. What if something like sizeof() was used? >Adding or removing private members from a class may change its size. > >Eduardo Krell AT&T Bell Laboratories, Murray Hill, NJ > >UUCP: {att,decvax,ucbvax}!ulysses!ekrell Internet: ekrell@ulysses.att.com The problem you mentioned above really only hit half of the target. If the sizeof() was used, the data type involved really is not private as far as I can see. If you consider the example I mentioned in the posting, i.e, an object that handles a table of values. The changes of table size should not affect those object who use it, since they are only interested in storing and retrieve data elements. But the changes of the table element size should, since the data element type is part of interface specification. But, C++ simply does not support any mechansim like ada and modula-2 that help in distincting these situations. Thus, in most cases, you have to take care of what should be recompiled and what needs not. I feel this is a very serious problem if we want to use C++ in a large project or consider it as an object-oriented language. --------- -- YUNG-KAO HSU School Of Infomation & Computer Science, Georgia Tech Atlanta GA30332 Internet: hsu@cumulus.gatech.edu CSNet: hsu%cumulus@gatech UUCP: ...!{akgua,allegra,amd,hplabs,seismo,ihnp4}!gatech!cumulus!hsu