Write a cpp program to setDimension and showDimension of a box using class and object?
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
class Box //Local class
{
private:
int l,b,h;
public:
void setDimension(int length, int bridth, int height)
{ l=length; b=bridth; h=height }
void showDimension()
{
cout<<"Length = "<<l<<endl;
cout<<"Bridth = "<<b<<endl;
cout<<"Height = "<<h;
}
};
Box obj;
obj.setDimension(20,25,60);
obj.showDimension();
}
Comments