|Synopsis:||It shall be possible to use a pointer or reference to an object of a derived class wherever a pointer or reference to a public base class object is used|
|Category:||Object Oriented Programming|
A class inherits from another class to reuse either the implementation or the class interface. Public inheritance makes it possible to write code that only depends on the base class interface, not the implementation. Public inheritance should only be used if derived class objects are supposed to be operated upon through base class pointers or references.
This rule is known as the "Liskov Substitution Principle", see [Liskov] for more details.