Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- class building
- {
- int room, sqft;
- public:
- building()
- {
- room=sqft=0;
- }
- building(int x, int y)
- {
- room=x;
- sqft=y;
- }
- input()
- {
- cout<<"Please Enter Room Number: ";
- cin>>room;
- cout<<"Please Enter Size in Squire Feet: ";
- cin>>sqft;
- }
- display()
- {
- cout<<"Room Number: "<<room<<endl;
- cout<<"Room Size: "<<sqft<<" Sqr ft"<<endl;
- }
- };
- class house:public building
- {
- int bedroom;
- public:
- house(int x, int y, int z):building(x,y)
- {
- bedroom=z;
- }
- display()
- {
- building::display();
- cout<<"Bedroom Number: "<<bedroom<<endl;
- }
- };
- class office:public building{
- int ext;
- public:
- office(int x, int y, int z):building(x,y)
- {
- ext=z;
- }
- display()
- {
- building::display();
- cout<<"Ext : "<<ext<<endl;
- }
- };
- int main()
- {
- house h(6,1500,4);
- h.display();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement