From 4929708044752876126
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,fe40a3780453cbe2
X-Google-Attributes: gidf78e5,public
From: jaf3@ritz.cec.wustl.edu (John Andrew Fingerhut)
Subject: Re: Virtual operator=
Date: 1995/05/19
Message-ID: <3pj1mk$hr1@ritz.cec.wustl.edu>#1/1
X-Deja-AN: 102964203
references: <rac-1905951238280001@intrigue.intrigue.com>
organization: Washington University, St. Louis MO
reply-to: sg3235@shelob.sbc.com
newsgroups: comp.std.c++

In article <rac-1905951238280001@intrigue.intrigue.com>,
Robert Coie <rac@intrigue.com> wrote:
:Apologies to sites who receive two versions of this, previous post
:cancelled due to egregious error in sample code.
:
:Given the note in verse 2 of 13.5.3,
:
:Note: for a derived class D with a base class B for which a virtual copy
:assignment has been declared, the copy assignment operator in D does not
:override B's virtual copy assignment operator.
:
:I would assume that:
:
:struct A { virtual A & operator=( const A & ); };
:struct B : A { B & operator=( const A & ); };
:
:static void f( A & a )
:{
:   A * a2 = new A;
:   a = *a2;    // calls A::operator= ???
:}
:
:int main()
:{
:   B  b;
:   f( b );
:}
:
:If this is the case, and B::operator= is not invoked in the commented
:line, what is the point of virtual copy assignment operators?
:
:Robert Coie                              rac@intrigue.com
:Implementor, Intrigue Corporation     AppleLink: INTRIGUE

I believe that the note means that your commented line will not invoke
B::operator=( const B & ).  It will still invoke B::operator= ( const A & ).
-- 
Stephen Gevers
sg3235@shelob.sbc.com



