Why aren't assignment operators inherited automatically?
Jonathan Wakely
cow@compsoc.man.ac.uk
Wed Mar 16 13:50:00 GMT 2005
On Wed, Mar 16, 2005 at 10:45:16AM +0200, Topi Maenpaa wrote:
> In short, anything inherited from the base class can be used as expected,
> except the assignment operator. What's the deal? I'm doing this on Mandrake
> 10.1, gcc 3.4.1, if that matters.
This question is about C++, not the development of GCC, so would be
better suited somewhere like comp.lang.c++
Basically, G++ does what the standard requires. The assignment operator
is special, if you don't declare one the compiler does so implicitly and
the implicit operator= hides the inherited one.
See a good C++ reference for "name hiding".
jon
More information about the Gcc
mailing list