Topic: operator= in derived class does not copy base class ?


Author: rfg@netcom.com (Ronald F. Guilmette)
Date: Sun, 17 Oct 1993 17:10:44 GMT
Raw View
In article <CEF1vB.MMr@mdc.netuse.de> olaf@mdc.netuse.de (Olaf Schlueter) writes:
>a "followup" question is emerging: if the operator= is not
>inherited, what happens (C++ compliant) in a class heriarchy, where
>an intermediate base class overloads the operator=, i.e.
>
>class A {..}; class B: public A { operator=(); } ; class C: public B {...};
>
>Noninheritance should mean, objects of class C should be copied by element,
>ignoring the overloaded operator in class B.
>
>What I discover when I try a construction like the above is that C's B "part"
>get copied using B::operator=, but if this operator omits explicit copying
>of class A, A is not copied. That may be what one is expecting from it,
>but it contradicts Stroutstrup's Statement that operator= is not inherited.

As you have so clearly illustrated, the precise meaning of the phrase "not
inherited" is vague, and is open to interpretation.

(Follow-ups to comp.std.c++ please.)

--

-- Ronald F. Guilmette ------------------------------------------------------
------ domain address: rfg@netcom.com ---------------------------------------
------ uucp address: ...!uunet!netcom.com!rfg -------------------------------