#include #include using namespace std; class Punkt{ private: int x, y; public: Punkt(){ } Punkt(int x, int y){ this->x = x; this->y = y; } friend ostream& operator<<(ostream& os, Punkt& pp); friend istream& operator>>(istream& is, Punkt& pp); }; ostream& operator<<(ostream& os, Punkt& pp){ os << "{" << pp.x << ", " << pp.y << "}"; return os; } istream& operator>>(istream& is, Punkt& pp){ is >> pp.x; is >> pp.y; return is; } class Odcinek{ private: Punkt p, k; public: Odcinek(Punkt p, Punkt k){ this->p = p; this->k = k; } friend ostream &operator<<(ostream &os, Odcinek &od); }; ostream &operator<<(ostream &os, Odcinek &od){ os << od.p << " <-> " << od.k; return os; } int main(){ Odcinek od(Punkt(10,5), Punkt(50, 20)); cout << od; return 0; }