Base class method hidden by child class overload

Hi,

I have a base class BaseClass that defines
const SomeType & BaseClass::operator >> (SomeType&)const;
I have a child class of BaseClass. Until now, i could use the operator >> of the base class on an object of the child class.
But since i added
const OtherType& ChildClass::operator >> (OtherType&)const;
as a member in ChildClass, the compiler doesn't find a candidate for operator >> in the places i use the operator of the base class on an object of the child class.

I can overload an other operator on the child class that just calls the base class method and my problem is solved, but that means i will have to overload a method for each child class of the base class, even though they will have the same code.

Do you have an idea what's the reason for this, and is there a workaround?
Try declaring them as friend functions.
Does that mean i have to use a function name instead of an operator, like this?

friend void BaseClass_To_SomeType(OtherType&, const BaseClasse&);
No.
Ah, you are right. I didn't know that operators could be functions, i believed they could only be class methods.
Topic archived. No new replies allowed.