HackerRank Rectangle Area in C++ problem solution

In this HackerRank Rectangle Area problem in c++ problem solution, we are required to compute the area of a rectangle using classes.

HackerRank Rectangle Area in C++ problem solution

 

HackerRank Rectangle Area in C++ problem solution

class Rectangle {
public:
int width, height;
void Input() {
cin >> width >> height;
}
void Display() {
cout << width << ' ' << height << endl;
}
};

class RectangleArea : public Rectangle {
public:
void Display() {
cout << width * height << endl;
}
};


Post a Comment

0 Comments