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
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;
}
};
0 Comments