#include<iostream.h>
class rectangle
{
protected:
int lenght,widht,height;
public:
rectangle(){lenght=0;widht=0;height=0;};
void seta(int lenghti);
void setb(int widthi);
void setc(int heighti);
int getlenght();
int getwidth();
int getheight();
};
class box:protected rectangle
{
private:
int length,width,height;
public:
rectangle(){length=0;width=0;height=0;};
void setlenght(int lenght);
void setwidth(int width);
void setheight(int height);
int getlenght();
int getwidht();
int getArea();
int getPerimeter();
int getVolume();
};
#include<iostream.h>
#include"rectangle.h"
void main()
{
box mybox;
int lenght,widht,height;
cout<<"enter lenght";
cin>>lenght;
cout<<"enter width";
cin>>width;
cout<<"enter height";
cin>>height;
int a,b,c,;
cout<<"enter lenght";cin>>lenght;
cout<<"enter width";cin>>widht;
cout<<"enter height";cin>>height;
mybox.setlenght(lenght);
mybox.setwidth(width);
mybox.setheight(height);
cout<<"Area is"<<mybox.getArea()endl;
cout<<"Parameter is"<<mybox.getparameter()endl;
cout<<"volume is"<<mybox.getvolume()endl;
#include<iostream.h>
#include"rectangle.h"
#include"mybox.cpp"
void box::seta,b,c,(int a,int b,int c,);
{
lenght=a;
widht=b;
height=c;
}
{
int box::geta();
return a;
}
{
int box::getb();
return b;
}
}
int box::getc();
return c;
}
{
int box::getarea()
return a*b;
}
{
int box::getparameter()
return a+b;
}
{
int box::getVolume()
return a*b*c;
}
brianotieno 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
ludesign 0 Newbie Poster
dwks 149 Posting Whiz in Training
dwks 149 Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.