Notes on Defective C++

Nick Sabalausky a at a.a
Sun Dec 7 18:23:45 PST 2008


"Walter Bright" <newshound1 at digitalmars.com> wrote in message 
news:ghh7r5$436$1 at digitalmars.com...
> bearophile wrote:
>> 1) No compile time encapsulation: "In naturally written C++ code,
>> changing the private members of a class requires recompilation of the
>> code using the class." I think D solves this problem, you only have
>> to compile the module the contains the class (generally a module
>> contains related classes/functions).
>
> D doesn't solve this problem. Changing the private members changes offsets 
> of other members and derived classes, so they must all be recompiled. 
> Inline functions are also, of course, affected.
>
> The way to avoid this is to use interfaces.

Would there be any problem with making all the public members come first, 
then the protected, then the private? That way changing private members 
wouldn't change the offsets of public and protected members. (Not that I 
consider this a major issue.) 





More information about the Digitalmars-d mailing list