Follow member function conventions

Follow these conventions when designing and using member functions:

Protected constructors or pure virtual functions indicate an abstract base class in the Taligent Application Environment (in C++, only a pure virtual function indicates an abstract base class; protected constructors do not).

A private copy constructor or assignment operator indicates a class that cannot be copied.

A function whose implementation is inline doesn't change its implementation (although it might be extended).

Protected members can only be accessed by derived classes.

Private virtual functions can be overridden but not called.

If a member function is defined to have no implementation (for all eternity), it is permissible to define it as an empty body in the class declaration. This is much better than not providing a constructor at all.

      class TFoo {
      public:
          TFoo() {};          // Will ALWAYS be empty!
      };
NOTE Don't assume that a virtual function may be overridden. The class author might want to allow overriding in the future, but that doesn't mean you may override it now. The rules for subclassing must be spelled out in the class' documentation (see "Design the interfaces between the base and derived classes" on page 40). Never override a function that isn't documented to be overridable. And never override a function in a way that isn't in accordance with its documentation.

In general, define an empty body only for special members of abstract base classes with no implementation or storage.


[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