You are viewing a single comment's thread. Return to all comments →
What an asinine class design.
class Rectangle { public: Rectangle() = default; virtual void display() const { std::cout << _width << " " << _height << std::endl; } int area() const { return _width * _height; } protected: int _width = 0; int _height = 0; }; class RectangleArea : public Rectangle { public: RectangleArea() = default; virtual void display() const override { std::cout << area() << std::endl; } void read_input() { std::cin >> _width >> _height; } };
Seems like cookies are disabled on this browser, please enable them to open this website
Rectangle Area
You are viewing a single comment's thread. Return to all comments →
What an asinine class design.