Operator overloading and inheritence
ive been working on a operator = overloading function, and wondered whether it worked when in an inheritence hierarchy.
For example my base class implements the operator =, and the derived classes inherit this?
Do the derived classes inherit this? Does polymorphism allow this operator = class type to be derived at run time?
For example if i have a the following code:
Now at the moment it doesnt seem to work as each time i call the =operator it makes a copy of type const Cell&.
Juxtacrine j = new Juxtacrine(); // derived object from Cell
Morphogen m = new Morphogen(); //derived object from Cell different to Juxtacrine
m = j; // calls Cell& operator =(Cell& c) - base class implementation
Am i going down the right path ? or do i need to rethink what im doing?
Thanks in advance..