Files
cpp-course/modules/06_oop_basics/include/polymorphism.hpp
T

31 lines
627 B
C++
Raw Normal View History

2026-08-11 17:40:36 +03:00
#pragma once
#include "inheritance.hpp"
#include <memory>
#include <string>
#include <vector>
namespace oop {
[[nodiscard]] auto total_area(const std::vector<std::unique_ptr<Shape>>& shapes) -> double;
[[nodiscard]] auto shape_names(const std::vector<std::unique_ptr<Shape>>& shapes)
-> std::vector<std::string>;
class Counter {
public:
Counter() = default;
Counter(const Counter&) { ++copies_; }
auto operator=(const Counter&) -> Counter& {
++copies_;
return *this;
}
[[nodiscard]] static auto copies() -> int;
private:
inline static int copies_ = 0;
};
} // namespace oop