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 (names of member functions are same in base class and derived class) #include
#include
class box { int width; int depth; int height; public: void getdata() { cout<<"\nenter width of box "; cin>>width; cout<<"\nenter depth of box "; cin>>depth; cout<<"\nenter height of box "; cin>>height; } void showdata() { cout<<"\nwidth of box is "<
>weight; } void showdata() { box::showdata(); cout<<"\nweight of box is "<
>cost; } void showdata() { boxweight::showdata(); cout<<"\nshipping cost is "<