class A { .... ... .... }; class B : public A { .... ... .... }; class C : public B { .... ... .... };
#include <iostream>
class A
{
public:
void display()
{
cout<<"Base class content.";
}
};
class B : public A
{
};
class C : public B
{
};
void main()
{
C c;
c.display();
getch();
}
Output:
Base class content.
main()
function.display()
function is called, display()
in class A is executed because there is no display()
function inC and B.display()
in class C first but, can't find it.
Ask Question