Solution:
#include<iostream>
using namespace std;
class Apple
{
public:
Apple() //default constructor
{
cout<<"Apple Constructor called"<<endl;
}
};
class Grapes
{
public:
Grapes() //default constructor
{
cout<<"Grapes Constructor called\n";
}
class Guava
{
public:
Guava() //default constructor
{
cout<<"Guava Constructor called\n";
}
};
class CookingOil
{
public:
CookingOil() //default constructor
{
cout<<"Cookingoil Constructor called\n";
}
};
class Rice
{
public:
Rice() //default constructor
{
cout<<"Rice Constructor called\n";
}
};
class Flour
{
public:
Flour() //default constructor
{
cout<<"Flour Constructor called\n";
}
};
class TetraMilk
{
public:
TetraMilk() //default constructor
{
cout<<"TetraMilk Constructor called\n";
}
};
class Whitener
{
public:
Whitener() //default constructor
{
cout<<"Whitener Constructor called\n";
}
};
class Cream
{
public:
Cream() //default constructor
{
cout<<"Cream Constructor called\n";
}
};
class FruitStore
{
private:
Apple ap;
Grapes gr;
Guava gv;
public:
FruitStore() //default constructor
{
cout<<"\nFruitStore Constructor called\n\n";
}
};
class DairyStore
{
private:
TetraMilk tm;
Whitener wt;
Cream cr;
public:
DairyStore() //default constructor
{
cout<<"\nDairyStore Constructor called\n\n";
}
};
class GroceryStore
{
private:
CookingOil co;
Rice ri;
Flour fl;
public:
GroceryStore() //default constructor
{
cout<<"\nGroceryStore Constructor Called\n\n";
}
};
class GroceryHome
{
private:
FruitStore fst;
GroceryStore gst;
DairyStore dst;
public:
GroceryHome() //default constructor
{
cout<<"GroceryHome Constructor Called\n\n";
}
};
main()
{
GroceryHome gh;
system("pause");
}
Download Solution File:
Post a Comment