Why the function from immediate parent is called and not from grandparent class. Is this called func

Posted by sandeep on Stack Overflow See other posts from Stack Overflow or by sandeep
Published on 2010-03-20T13:44:03Z Indexed on 2010/03/20 13:51 UTC
Read the original article Hit count: 127

Filed under:
class A
{
public:
void test ()
{
cout<<"In A";
}
};
class B :public A
{
public:
void test ()
{
cout<<"In B";
}
};
class C : public B
{

public:
int c;
};
int main()
{
C c;
c.test();
}

The result is: In B...

© Stack Overflow or respective owner

Related posts about c++