Back To C++ Classes
//program to create a class box with data members (width,depth and height) and member functions (getdata,showdata and volume)(volume member function calculates the volume of the box ) #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 volume() { int vol; vol=width*depth*height; cout<<"\nvolume of box is "<