// C++ does polymorphism
class A                                 // base class declaration
{
public:
	A() { index = 0; }              // constructor

	virtual void                    // virtual allows overloading
	doIncrement() { index++; }      // manipulator definition
protected:
	int	index;                  // hidden member variable
};

class B : public A                      // subclass declaration
{
public:
	virtual void
	doIncrement() { index += 3; }   // overloaded manipulator
	
};

class C : public A                      // another subclass declaration
{
public:
	virtual void
	doIncrement() { index += 7; }   // overloaded manipulator
};

main()
{
	A a;
	a.doIncrement();

	B b;
	b.doIncrement();

	C c;
	c.doIncrement();
}