I have a parent class Obj with empty virtual function cmp
class Obj{
public:
virtual int cmp(const Obj& val) = 0;
...
};
I am trying to define that function in the subclass MyString, but instead of const Obj&
as argument, i use const MyString&
which probably occures the error "Emprty virtual function Obj::cmp
has no redifinition"
class MyString : public Obj{
private:
...
public:
virtual int cmp(const MyString& val){
... using private values of MyString
}
};
So how can i solve that, if i have 3-4 subclasses which uses their own variables in that function