From 7a44e8fbc2b7c06dbf71b59eea1e865d9b06118a Mon Sep 17 00:00:00 2001 From: studiosi Date: Sat, 15 Aug 2026 21:00:19 +0300 Subject: [PATCH] Solved: 22 - Polymorphism --- modules/06_oop_basics/src/polymorphism.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/06_oop_basics/src/polymorphism.cpp b/modules/06_oop_basics/src/polymorphism.cpp index cafd0a3..2d36cd0 100644 --- a/modules/06_oop_basics/src/polymorphism.cpp +++ b/modules/06_oop_basics/src/polymorphism.cpp @@ -5,8 +5,7 @@ namespace oop { auto total_area(const std::vector>& shapes) -> double { double total = 0.0; for (const auto& shape : shapes) { - // TODO: Add each shape's area using polymorphism - (void)shape; + total += shape->area(); } return total; } @@ -15,8 +14,7 @@ auto shape_names(const std::vector>& shapes) -> std::vector { std::vector names; for (const auto& shape : shapes) { - // TODO: Collect shape->name() - (void)shape; + names.push_back(shape->name()); } return names; }