1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#include<iostream>
using namespace std;
class point
{
int x,y;
public:
point(int a=0,int b=0)
{
x=a;
y=b;
cout<<"la construction de l'objet "<<x<<" "<<y<<endl;
}
void affiche()
{
cout<<"l'objet courant est "<<x<<" "<<y<<endl;
}
point& sym()
{
point res;
res.x=-x;
res.y=-y;
return res;
}
~point()
{
cout<<"la destruction de l'objet "<<x<<" "<<y<<endl;
}
};
int main()
{
point no(9,9),lo;
lo=no.sym();
lo.affiche();
system("PAUSE");
return 0;
} |
Partager