Back To C++ Inheritance Index
//program to demonstrate multilevel inheritance, class boxweight is derived from base class box and class shipment is derived from class boxweight #include
#include
class box { int width; int depth; int height; public: void bgetdata() { cout<<"\nenter width of box "; cin>>width; cout<<"\nenter depth of box "; cin>>depth; cout<<"\nenter height of box "; cin>>height; } void bshowdata() { cout<<"\nwidth of box is "<
>weight; } void wshowdata() { bshowdata(); cout<<"\nweight of box is "<
>cost; } void sshowdata() { wshowdata(); cout<<"\nshipping cost is "<