Documente Academic
Documente Profesional
Documente Cultură
Departamentul
REFERAT
la lucrarea de laborator nr.3
Chișinău 2019
Varianta 14
class CPlane {
private:
int x, y;
public:
CPlane();
CPlane(int ax, int ay);
CPlane(const CPlane &p);
~CPlane()
{
//Empty Destructor;
}
void print_xy()
{
cout << "x=" << x << " y=" << y << endl;
}
CPlane& operator=(const CPlane &aPlane);
friend CPlane operator+(const CPlane &aP1, const CPlane &aP2);
};
CPlane::CPlane()
{
x = 0;
y = 0;
}
CPlane::CPlane(int ax, int ay)
{
x = ax;
y = ay;
}
CPlane::CPlane(const CPlane &p)
{
x = p.x;
y = p.y;
}
int main()
{
char a;
int m, n, f, g;
cout<<"Introduceti coordonatele primului numar"<<endl;
cout<<"m=";
cin>>m;
cout<<"n=";
cin>>n;
cout<<"Introduceti coordonatele celui deal doilea numar"<<endl;
cout<<"f=";
cin>>f;
cout<<"g=";
cin>>g;
CPlane p1(m,n), p2(f,g),p3;
cout << "P1: ";
p1.print_xy();
cout << "P2: ";
p2.print_xy();
p3 = p1 + p2;