On 22 Jun 2004 03:26:56 -0700,
przemyslaw.sliwa@gazeta.pl (Przemek)
wrote:
[color=blue]
>Dear All,
>
>I would like to know why the overriden operator = is not calles
>properly by the function test in the following code. I really do not
>understand it.[/color]
[snip]
As others have pointed out, the arguments for operator= differ, so
they are overloaded, but not overriden functions (or did I get this
backwards again?).
One way of implementing such a polymorphic assignment operator would
be to make the base class operator= the only publicly accessible one.
It would not need to be virtual because it will not be overridden. Do
any assignment to base class members there and have an additional
protected pure virtual "assign()" function which the base class'
operator= calls. Override the protected "assign()" function, but hide
the operator= in the derived classes (by declaring it as private but
do not provide a body for it).
--
Bob Hairgrove
NoSpamPlease@Home.com