I came across the scenario where the constructor of base class IBuy is not called. Ideally it should be called as it is inherited in shop class and shop is inherited in mall class. Please resolve this query
#include <iostream>
using namespace std;
class Ibuy
{
public:
Ibuy(){"Ibuy default constructor \n";}
virtual void nameItem()=0;
};
class shop: public Ibuy
{
public:
shop()
{
cout<<"def constructor of shop class \n";
}
void shopName(string name)
{
cout<<"Name of shop is: "<<name<<endl;
}
};
class mall:public shop
{
public:
void nameItem()
{
cout<<"Item name... \n ";
}
};
int main()
{
cout<<"Abstract class \n";
mall mObj;
mObj.shopName("vishal mart");
mObj.nameItem();
return 0;
}