Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!sharkey!math.lsa.umich.edu!zaphod.mps.ohio-state.edu!maverick.ksu.ksu.edu!unmvax!tut.cis.ohio-state.edu!att!dptg!ulysses!andante!alice!ark From: ark@alice.UUCP (Andrew Koenig) Newsgroups: comp.lang.c++ Subject: Re: Question on X(X&) semantics Message-ID: <10849@alice.UUCP> Date: 21 May 90 21:51:39 GMT References: Distribution: na Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 32 In article , 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