// BINDTST1.CPP
// 96-03-29  KHU  Creation.

#include <iostream.h>

	class A
	{
	public:
		virtual void f (int i)
		{
			cout << i << ". calls A::f" << endl;
		};
	};

	class B : public A
	{
	public:
		virtual void f (int i)
		{
			cout << i << ". calls B::f" << endl;
		};
	};

	class C : public B
	{
	public:
		void f (int i)
		{
			cout << i << ". calls C::f" << endl;
		};
	};

	class D : public B
	{
	public:
		void f (int i, int k = 12)
		{
			cout << i << ". calls D::f" << endl;
		};
	};

	void main ()
	{
		A a;
		B b;
		C c;
		D d;
		A * ap;
		B * bp;
		C * cp;
		D * dp;

		a.f(1);
		b.f(2);
		c.f(3);
		d.f(4);
		ap = &a;
		ap->f(5);
		ap = &b;
		ap->f(6);
		ap = &c;
		ap->f(7);
		ap = &d;
		ap->f(8);
		a = b;
		a.f(9);
		a = c;
		a.f(10);
		a = d;
		a.f(11);
		ap = new B;
		ap->f(12);
		ap = new C;
		ap->f(13);
		ap = new D;
		ap->f(14);
		bp = new B;
		bp->f(15);
		cp = new C;
		cp->f(16);
		dp = new D;
		dp->f(17);
		dp->f(18, 18);
	};
