#include<iostream>
using namespace std;
class a
{
public:
virtual void add()
{
cout<<"in a class";
}
};
class b: public a
{
public:
void add()
{
cout<<"in b class ";
};
class c : public b
{
};
class d: public c
{
};
int main()
{
c *p;
d q;
p=&q;
p->add();
return 0;
}
// the output of this code Is b::add()
but we are working with class c and d can anyone explain me ?