State explicit use of public, private, and protected

Though C++ frequently allows you to leave out the private keyword, don't do it. Class definitions should always explicitly state the visibility of their members and base classes. When you have multiple instances of the sections, they should appear in the following order (such as one set of public-protected-private followed by another set of public-protected-private):

      class TFoo: public TBar, protected MBlat, private MBaz {
          // public members;
          // protected members;
          // private members;

NOTE The private section is necessary only to make the compiler happy, so it should be last. When using the Taligent Development System, the private interface might not even be visible to clients, and the protected interface might only be visible to subclasses (private virtual functions are an exception).

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker