// This example shows that the functions inherited by a derived class from a // base class can be overriden by the derived class by providing a new // definition for it #includeSee the output of the above programclass A { public : void foo (); }; class B : public A { public : void foo (); }; void A::foo () { cout << "Hi again !!\n"; } void B::foo () { cout << "Hi !!\n"; } void main () { B b; b.foo (); // invoking B::foo () b.A::foo (); // invoking A::foo () }