// BINDTST2.CPP
// 97-05-21  KHU  Creation.

#include <iostream.h>

	class A
	{
	public:
		virtual void f (int i)
		{
			cout << i << ". calls A::f" << endl;
		};
		void g (int i)
		{
			cout << i << ". calls A::g" << endl;
		};
	};

	class B : public A
	{
	public:
		virtual void f (int i)
		{
			cout << i << ". calls B::f" << endl;
		};
		void g (int i)
		{
			cout << i << ". calls B::g" << endl;
		};
	};

	class C : public B
	{
	public:
		void f (int i)
		{
			cout << i << ". calls C::f" << endl;
		};
		virtual void g (int i)
		{
			cout << i << ". calls C::g" << endl;
		};
	};

	class D : public B
	{
	public:
		void f (float i)
		{
			cout << i << ". calls D::f" << endl;
		};
		void g (float i)
		{
			cout << i << ". calls D::g" << endl;
		};
	};

	class E : public B
	{
	public:
		void f (int i, int k = 12)
		{
			cout << i << ". calls E::f" << endl;
		};
	};

	void main ()
	{
		A a;
		B b;
		C c;
		D d;
		E e;
		A * ap;
		B * bp;
		C * cp;
		D * dp;
		E * ep;

		a.f(1);
		a.f(1.0);
		a.g(1);
		a.g(1.0);

		b.f(2);
		b.f(2.0);
		b.g(2);
		b.g(2.0);

		c.f(3);
		c.f(3.0);
		c.g(3);
		c.g(3.0);

		d.f(4);
		d.f(4.0);
		d.g(4);
		d.g(4.0);

		e.f(5);
		e.f(5.0);
		e.g(5);
		e.g(5.0);

		ap = &a;
		ap->f(6);
		ap->f(6.0);
		ap->g(6);
		ap->g(6.0);

		ap = &b;
		ap->f(7);
		ap->f(7.0);
		ap->g(7);
		ap->g(7.0);

		ap = &c;
		ap->f(8);
		ap->f(8.0);
		ap->g(8);
		ap->g(8.0);

		ap = &d;
		ap->f(9);
		ap->f(9.0);
		ap->g(9);
		ap->g(9.0);

		ap = &e;
		ap->f(10);
		ap->f(10.0);
		ap->g(10);
		ap->g(10.0);

		bp = &b;
		bp->f(11);
		bp->f(11.0);
		bp->g(11);
		bp->g(11.0);

		bp = &c;
		bp->f(12);
		bp->f(12.0);
		bp->g(12);
		bp->g(12.0);

		bp = &d;
		bp->f(13);
		bp->f(13.0);
		bp->g(13);
		bp->g(13.0);

		bp = &e;
		bp->f(14);
		bp->f(14.0);
		bp->g(14);
		bp->g(14.0);

		cp = &c;
		cp->f(15);
		cp->f(15.0);
		cp->g(15);
		cp->g(15.0);

		dp = &d;
		dp->f(16);
		dp->f(16.0);
		dp->g(16);
		dp->g(16.0);

		ep = &e;
		ep->f(17);
		ep->f(17.0);
		ep->g(17);
		ep->g(17.0);
	};
