Oh, and you might want B's print() to show the inherited part of the object by calling A's print():
In this case, if you decide to hide print() from the clients, you would have to make it protected, not private.Code:class B : public A { public: virtual void print (std::ostream & os) const { os << "Object of class B. Base: "; A::print (os); } //...
If I leave print() public, you might argue that my operator<< is just syntax sugar, but... yum! :-)