#include "point.h" Point::Point(){ SetxVal(0); SetyVal(0); marv++; } Point::Point(int ux, int uy){ SetxVal(ux); SetyVal(uy); marv++; } Point::Point( float kulma){ float pituus=10; SetxVal(pituus* cos(kulma)); SetyVal(pituus* sin(kulma)); marv++; } Point::Point(Point& p){ SetxVal(p.GetxVal()); SetyVal(p.GetyVal()); marv++; } Point::~Point(){ tulosta(); cout << "Loppu" << endl; marv--; } int Point::marv=0; void Point::SetxVal(int ux){ mx=ux; } void Point::SetyVal(int uy){ my=uy; } int Point::GetxVal() const{ return mx; } int Point::GetyVal() const{ return my; } void Point::tulosta(){ cout << "pt:n arvo on " << mx << "; " << my << " yhdessa " << Point::marv << endl; } Point Point::operator +(const Point& p) const{ return Point(mx+p.GetxVal(), my+p.GetyVal()); } int Point::GetLkm(){ return marv; } Point Point::operator++(int){ mx++; return *this; } Point Point::operator++(){ mx++; return *this; } int Point::operator[](int nr) const{ if(nr==0) return mx; if(nr==1) return my; return -1; } ostream& operator<<(ostream& voog, const Point& p){ voog << "(" << p.GetxVal()<< ", " << p.GetyVal() << ") "; return voog; }