Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!microsoft!jimad From: jimad@microsoft.UUCP (Jim ADCOCK) Newsgroups: comp.lang.c++ Subject: Re: Copying objects Message-ID: <55658@microsoft.UUCP> Date: 5 Jul 90 16:53:01 GMT References: <18753@well.sf.ca.us> <4853@darkstar.ucsc.edu> <55612@microsoft.UUCP> <304@taumet.com> Reply-To: jimad@microsoft.UUCP (Jim ADCOCK) Distribution: comp Organization: Microsoft Corp., Redmond WA Lines: 24 In article <304@taumet.com> steve@taumet.UUCP (Stephen Clamage) writes: |In article <55612@microsoft.UUCP> jimad@microsoft.UUCP (Jim ADCOCK) writes: |>Interestingly, operator= has the unique characteristic of being |>virtual but not inherited! Can someone explain what this is suppose |>to mean? .... |The ARM states that the default operator= (memberwise assignment) is |generated if (among other things) its address is taken. If a derived |class needs a virtual operator= and the programmer does not declare one, |the compiler should generate the default version and put it in the |virtual table. If this didn't happen, it may be a bug in the compiler, |or a compiler written to an earlier version of C++. Look at the example again. The compiler should only generate a default operator= of the form D& D::operator=([const] D&). But the virtual function whose template to be matched is B& D::operator=(const B&). So presumably, a compiler should, in the special case of virtual operator=, give a compile time squawk if B& D::operator=(const B&) isn't explicitly defined in every subclass D of B ? [The compiler I tried this example on erroneously allowed D to inherit B& B::operator=(const B&) via the vtable] Still doesn't answer my question though -- what is this suppose to *mean* ???