// Базовый класс фигуры class Shape { protected: //В нем определены начальная точка фигуры double x; double y; public: Shape(double x = 0,double y=0) { this->x = x; this->y = y; } Shape(const Shape& other) { this->x = other.x; this->y = other.y; } Shape(Shape&& other) noexcept { this->x = other.x; this->y = other.y; } // Виртуальная функция для вычисления площади virtual double fig_area(); }; class Circle : public Shape { private: double r; public: Circle(double x = 0, double y = 0, double r=1) { this->x = x; this->y = y; this->r = r; } Circle(const Circle& other) { this->x = other.x; this->y = other.y; this->r = other.r; } Circle(Circle&& other) noexcept { this->x = other.x; this->y = other.y; this->r = other.r; } double fig_area() override { return pow(r, 2.0)*PI; } };
Главная страница » Лібраріум » Кафедра ШІ » С++ »