Implement full protocol in derived classes

If a base class is public, the derived class must correctly implement all aspects of the base class' public interface (or the inherited implementation must operate correctly). Every member function must function properly for the same range of arguments as accepted by the base class. If this isn't the case, the derived class is not a true subtype of the base, which can cause subtle and mysterious errors. If you don't want to implement everything the base class exports, make it a private base class.


[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