[net.lang.c++] pointers to virtual functions

trl@cbrma.UUCP (Tom Lanning) (03/26/86)

	Is this a bug in my version of cfront, or a natural attribute of
C++? 

	class one {
	public:
		void (*pointer)();
		virtual void x () { cout << "one"; }
		virtual void y () { (*pointer)(); }

		one () { pointer = x; }
	}

	class two : public one {
	public:
		virtual void x () { cout << "two"; }
	}


	When I create an object of class "two", i.e.

		two object;

	and call "object.y ()", I get "one", not "two" like I want, and
	would somewhat expect.  Is this correct?  If "x" is a virtual
	function I would expect "pointer" to point to a "virtual function"
	pointer that changes with each derived class.  Instead it appears
	that the value is fixed when the pointer is assigned a value.  Any
	comments?  Thanks.
-- 

  Tom Lanning   AT&T Bell Laboratories   Columbus OH   43213     614-860-4153