From a33ef36d8e4ea0273107407bfff9ae1ff009e335 Mon Sep 17 00:00:00 2001 From: studiosi Date: Sat, 15 Aug 2026 20:58:48 +0300 Subject: [PATCH] Solved: 21 - Inheritance --- modules/06_oop_basics/src/inheritance.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/06_oop_basics/src/inheritance.cpp b/modules/06_oop_basics/src/inheritance.cpp index afc0143..847c630 100644 --- a/modules/06_oop_basics/src/inheritance.cpp +++ b/modules/06_oop_basics/src/inheritance.cpp @@ -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_; }