Nick Sabalausky wrote:
"Walter Bright" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
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.)

With inheritance, I'm not sure this is possible.

class A
{
  public int a;
  private int b;
}

class B : A
{
  public int c;
  private int d;
}


Sean

Reply via email to