Untitled

 avatar
unknown
plain_text
2 years ago
775 B
3
Indexable
#ifndef INC_5_POINT_H
#define INC_5_POINT_H

#include <iostream>

class Point {

public:
    Point() : x_(0), y_(0) {}  //Конструктор за замовчуванням
    Point(double x, double y) : x_(x), y_(y) {}  //Конструктор ініціалізації
    ~Point() = default;  //Деструктор

    double x() const { return x_; }
    double y() const { return y_; }

    void setX(double x) {  x_ = x; }
    void setY(double y) {  y_ = y; }

    virtual double area() { return 0; }

    //Функція виведення
    friend std::ostream& operator << (std::ostream &os, const Point &point) {
        os << point.x() << "; " << point.y();
        return os;
    }

protected:
    double x_;
    double y_;
};


#endif //INC_5_POINT_H
Editor is loading...