Solved: 22 - Polymorphism

This commit is contained in:
2026-08-15 21:00:19 +03:00
parent a33ef36d8e
commit 7a44e8fbc2
+2 -4
View File
@@ -5,8 +5,7 @@ namespace oop {
auto total_area(const std::vector<std::unique_ptr<Shape>>& shapes) -> double { auto total_area(const std::vector<std::unique_ptr<Shape>>& shapes) -> double {
double total = 0.0; double total = 0.0;
for (const auto& shape : shapes) { for (const auto& shape : shapes) {
// TODO: Add each shape's area using polymorphism total += shape->area();
(void)shape;
} }
return total; return total;
} }
@@ -15,8 +14,7 @@ auto shape_names(const std::vector<std::unique_ptr<Shape>>& shapes)
-> std::vector<std::string> { -> std::vector<std::string> {
std::vector<std::string> names; std::vector<std::string> names;
for (const auto& shape : shapes) { for (const auto& shape : shapes) {
// TODO: Collect shape->name() names.push_back(shape->name());
(void)shape;
} }
return names; return names;
} }