Contents Up << >>

How can I protect subclasses from breaking when I change internal parts?

A class has two distinct interfaces for two distinct sets of clients:

Unless you expect all your subclasses to be built by your own team, you should consider making your base class's bits be "private:", and use "protected:" inline access functions to access these data. This way the private bits can change, but the derived class's code won't break unless you change the protected access functions.

  • Inheritance: Constructors and destructors