class Base {
...
public:
virtualconstwchar_t *Me() const{
return L"Base";
}
virtualbool IsMe(constwchar_t *me_char) final{
if ( wcscmpi( me_char, Me() ) == 0) {
returntrue;
} else {
returnfalse;
}
}
...
};
class Child : public Base {
public:
virtualconstwchar_t *Me() {
return L"Child";
}
};
Child obj;
obj.Me(); -> show Child;
obj.IsMe("Child") -> show false because Me in IsMe is Base
first on line 35 you shouldnt have a ; in the middle, secondly pretty sure final is a java keyword, with const being the c++ equivalent, thirdly if you want it ot return true, you need to rewrite it in child except Me() would return "Child". thats the advantage of virtual functions. if all of your methods dont share a name then they dont need to be virtual