Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!bywater!arnor!watson!blinn.watson.ibm.com!mittle From: mittle@blinn.watson.ibm.com (Josh Mittleman) Newsgroups: comp.lang.c++ Subject: Re: polymorphism on base objects? Keywords: C++, polymorphism, references, base objects, bug Message-ID: <1991May16.160803.22193@watson.ibm.com> Date: 16 May 91 16:08:03 GMT References: Sender: @watson.ibm.com Distribution: comp Organization: IBM T. J. Watson Research Lines: 19 I agree that your results are confusing, and I think that they are simply wrong. I compiled your code with the ATT v2.1 compiler, and I did not reproduce your results. My output was what you expected in the first place: test_a(b) : Class name: Base test_a(d1) : Class name: D1 test_a(bb) : Class name: Base test_b(b) : Class name: Base test_b(d1) : Class name: Base test_b(bb) : Class name: Base It is certainly incorrect to get polymorphism through a base class object, as opposed to through a base class pointer or reference. A Base is a Base, and cannot be anything but a Base. =========================================================================== Josh Mittleman (mittle@watson.ibm.com or joshua@paul.rutgers.edu) J2-C28 T.J. Watson Research Center, PO Box 704, Yorktown Heights, NY 10598