Untitled
unknown
plain_text
3 years ago
1.1 kB
6
Indexable
#ifndef INC_5_ELLIPSE_H
#define INC_5_ELLIPSE_H
#include <iostream>
#include <cmath>
#include "Point.h"
class Ellipse : public Point {
public:
Ellipse() : Point(), xrad_(0), yrad_(0) {} //Конструктор за замовчуванням
Ellipse(double x, double y) : Point(x, y), xrad_(0), yrad_(0) {} //Конструктори ініціалізації
Ellipse(double x, double y, double xrad, double yrad) : Point(x, y), xrad_(xrad), yrad_(yrad) {};
~Ellipse() = default; //Деструктор
//Обчислення площі
double area() override {
return 4 * xrad_ * yrad_ * M_PI;
}
double xrad() const { return xrad_; }
double yrad() const { return yrad_; }
//Функція виведення
friend std::ostream& operator<<(std::ostream &os, const Ellipse &ellipse) {
os << static_cast<const Point&>(ellipse) <<"; " << ellipse.xrad() << "; " << ellipse.yrad();
return os;
}
protected:
double xrad_;
private:
double yrad_;
};
#endif //INC_5_ELLIPSE_HEditor is loading...