Why doesn't this program give an error if there seems to be a naming conflict between the inherited foo() function from the Parent class and the exactly same header function foo() in the child class?
This is the code:
class Parent {
public:
Parent() {}
protected:
void foo() { std::cout << "foo-of-Parent" << std::endl;}
};
class Child:public Parent {
public:
Child() {};
void foo() { std::cout << "foo-of-Child" << std::endl; }
};
int main(){
Child john;
john.foo();
return 0;
}
Is the inherited function a member with kind of less priority in Child?