#include <iostream>
#include <string>
class Shape {
private:
int _x;
int _y;
public:
Shape(int x, int y) :
_x(x),
_y(y) {}
std::string get_coordinate() {
std::string result;
result += "(";
result += std::to_string(_x);
result += ", ";
result += std::to_string(_y);
result += ")";
return result;
}
virtual int get_area() = 0;
};
class Rectangle : public Shape {
private:
int _w;
int _h;
public:
Rectangle(int x, int y, int w, int h) :
Shape(x, y),
_w(w),
_h(h) {}
int get_area() override final {
return _w * _h;
}
std::string get_size() {
std::string result;
result += std::to_string(_w);
result += " x ";
result += std::to_string(_h);
return result;
}
};
int main(void) {
Rectangle rect(0, 0, 100, 100);
std::cout << rect.get_coordinate() << std::endl;
std::cout << rect.get_size() << " = " << rect.get_area() << std::endl;
return 0;
}