/************************************************************************ *
The following example shows how virtual functions can be redefined.
* ************************************************************************/
class B { public: virtual int f(); virtual int g(); int h(); }; class D : public B { public: int f(); int g(char*); // hides B::g() int h(); }; // ... void main () { D d; B* bptr = &d; bptr->f(); // calls D::f() because f() is virtual bptr->h(); // calls B::h() because h() is nonvirtual bptr->g(); // calls B::g() d.g(); // error, wrong number and type of arguments d.g("string"); // calls D::g(char*) }