Hello,
Thank you in advance for your time and help.
I was hoping someone could clear some confusion up, over operator overloading and ineritance.
If i have overloaded the << and the >> operators, for example to output an object of type Square, and then i have an object of type circle that inherits from the Square class - how can i ouput an object of type circle without retyping the overloaded operators to accept an object of type circle.
e.g
Code:
friend istream& operator>>(istream&, Square&);
friend ostream& operator<<(ostream&, const Square);
and then i have a subclass (circle)...
Code:
friend istream& operator>>(istream&, Circle&);
friend ostream& operator<<(ostream&, const Circle);
I don't want to re-declare all of my overloaded operators.
How is this achieved?
I really appreiate some guidance in this area.
Thank you for your time, help and advice.
Best regards, global