Solved: 21 - Inheritance

This commit is contained in:
2026-08-15 20:58:48 +03:00
parent 61d91878b9
commit a33ef36d8e
+3 -2
View File
@@ -2,11 +2,12 @@
namespace oop {
Circle::Circle(double radius) : radius_(radius) {}
Circle::Circle(const double radius) : radius_(radius) {}
auto Circle::name() const -> std::string { return "Circle"; }
auto Circle::area() const -> double { return 3.141592653589793 * radius_ * radius_; }
Rectangle::Rectangle(double width, double height) : width_(width), height_(height) {}
Rectangle::Rectangle(const double width, const double height) : width_(width), height_(height) {}
auto Rectangle::name() const -> std::string { return "Rectangle"; }
auto Rectangle::area() const -> double { return width_ * height_; }