[comp.lang.c++] Question on X

ark@alice.UUCP (Andrew Koenig) (05/22/90)

In article <DES.90May21112654@angler.amara.uucp>, des@amara.uucp (Dave Steinhoff) writes:

> I'm confused about the semantics of using copy constructors (X(X&))
> with formal arguments of a base class.  In short, it seems that the
> vtbl ptr of the *base* class is used if a copy constructor appears in
> the base class, but the vtbl ptr of the *derived* class is used if one
> does not.

It's a bug in cfront 2.0, fixed in cfront 2.1 .

If you have a function like this:

	void f1(B b)
	{
		// ...
	}

then the object named `b' inside this function should be of class B,
even if the actual parameter is of a class D derived from B.

If, on the other hand, you write

	void f2(B& b)
	{
		// ...
	}

then `b' can potentially refer to an object of class B or any class
derived from B.
-- 
				--Andrew Koenig
				  ark@europa.att.com