Skip to content

Commit

Permalink
Create rectangleArea-HR.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
saksham101 authored Dec 14, 2020
1 parent 575c054 commit e690649
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions rectangleArea-HR.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include <iostream>

using namespace std;

class Rectangle {
protected :
int width;
int height;
public :
void display(){
cout<<width<<" "<<height;
}
};

class RectangleArea : public Rectangle {
public :
void read_input(){
cin>>width>>height;
}
void display(){
cout<<endl<<width*height;
}
};


int main()
{
/*
* Declare a RectangleArea object
*/
RectangleArea r_area;

/*
* Read the width and height
*/
r_area.read_input();

/*
* Print the width and height
*/
r_area.Rectangle::display();

/*
* Print the area
*/
r_area.display();

return 0;
}

0 comments on commit e690649

Please sign in to comment.