Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!watdragon!violet!gjditchfield From: gjditchfield@violet.UUCP Newsgroups: comp.lang.c++ Subject: another bug? Message-ID: <3851@watdragon.waterloo.edu> Date: Mon, 19-Oct-87 14:22:54 EDT Article-I.D.: watdrago.3851 Posted: Mon Oct 19 14:22:54 1987 Date-Received: Tue, 20-Oct-87 03:15:48 EDT Sender: daemon@watdragon.waterloo.edu Distribution: comp Lines: 42 Keywords: inherited operator= I think this is a bug, but it may be that I don't understand the interaction of inheritance and operators. ---------------------------------------------------------------- class base { int i; public: base() {i = 10;}; int operator=( int ip) { int t = i; i = ip; return t;}; }; class derived: public base { float f; public: derived():() {}; }; #include main () { base b; derived d; cout << ( b=(5) ); cout << b.operator=(4); cout << d.operator=(15); cout << ( d=(16) ); // line 22 }; ------------------------------------------------------------ ccc dervEq.cc: "dervEq.cc", line 22: error: assignment not defined for class derived "dervEq.cc", line 22: error: pointer operand for << If "a = b" and "a.operator=(b)" are equivalent (lines 18, 19), and if derived did inherited "operator=" (line 21), why doesn't line 22 work? Oh, yes: C++ version 1.2.1, BSD 4.3 on a vax. The same for my previous posting, "Bug?" -- Glen Ditchfield {watmath,utzoo,ihnp4}!watrose!gjditchfield Dept of Computer Science, U of Waterloo (519) 885-1211 x6658 Waterloo, Ontario, Canada Office: MC 2006 If you grab the bull by the horns, you at least confuse him -- R.A.Heinlein