So I have a Base
class:
class Base
{
public:
std::ostream& operator << (std::ostream & out, const Base & base);
}
And I have defined what the operator should do:
ostream& operator << (std::ostream & out, const Base & base)
{
return out << "output";
}
If I have a Derived
class that extends Base
and I want Derived
to do the same thing as Base
when its insertion operator is called, what is the best way to go about doing this? And by best I mean best way to not reuse code.