I have a base class with one pure virtual function defined at the permission level protected.
A second class inherits from the first and implements the protected pure virtual function.
This second class has it's own public pure virtual function with the same name but different param's.
A third class inherits from the second and implements the public pure virtual function.
The compiler warns that the implemented public function is hidden by the protected function in the first class.
E.G
class ClassA
{
protected:
virtual void DoSomething() = 0;
};
class ClassB : ClassA
{
protected:
virtual void DoSomething();
public:
virtual void DoSomething(int aValue) = 0;
};
void ClassB::DoSomething()
{
Does something.
}
class ClassC : ClassB
{
public:
virtual void DoSomething(int aValue);
};
void ClassB::DoSomething(int aValue)
{
Does something.
}
The warning I get is "function "ClassA::DoSomething()" is hidden by "ClassC::DoSomething" virtual function override intended?" in file "/main.cpp", Line: 31, Col: 15
This is wrong as, C++ name mangling treats these functions as different functions because of their different parameters.
I have a base class with one pure virtual function defined at the permission level protected.
A second class inherits from the first and implements the protected pure virtual function. This second class has it's own public pure virtual function with the same name but different param's.
A third class inherits from the second and implements the public pure virtual function.
The compiler warns that the implemented public function is hidden by the protected function in the first class.
E.G
class ClassA { protected: virtual void DoSomething() = 0; };
class ClassB : ClassA { protected: virtual void DoSomething();
public: virtual void DoSomething(int aValue) = 0; };
void ClassB::DoSomething() { Does something. }
class ClassC : ClassB { public: virtual void DoSomething(int aValue); };
void ClassB::DoSomething(int aValue) { Does something. }
The warning I get is "function "ClassA::DoSomething()" is hidden by "ClassC::DoSomething"
virtual function override intended?" in file "/main.cpp", Line: 31, Col: 15This is wrong as, C++ name mangling treats these functions as different functions because of their different parameters.