Professional Documents
Culture Documents
Seance 2
Seance 2
class point
private:
int x, y;
char N;
public:
point()
x=a;y=b;N=C;
point(const point& A)
~point(){
cout<<"Au revoir";
void Afficher()
cout <<"x="<<getx()<<",";
cout <<"y="<<gety()<<",";
cout <<"N="<<getN()<<endl;
N=c;
x=a;
y=b;
};
int main()
O->Afficher();
C->Afficher();
D->setN('D');
D->setx(30);
D->sety(40);
cout<<O->getx() <<endl;
D->Afficher();
point Z(1,3,'Z');
Z.Afficher();
Exercice :
#include <iostream>
#include "point.h"
class rectangle
point A=point();
point B=point();
point C=point();
point D= point();
public:
rectangle()
//point A();
//point B(1,0,'B');
//point C(1,3,'C');
//point D(0,3,'D');
B.setx(1);
B.sety(0);
B.setN('B');
C.setx(1);
C.sety(3);
C.setN('C');
D.setx(0);
D.sety(3);
D.setN('D');
void Affiche_rec()
A.Afficher();
B.Afficher();
C.Afficher();
D.Afficher();
};
int main()
rectangle R=rectangle();
R.Affiche_rec();