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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
#include <cstdlib>
#include <iostream>
using namespace std;
//class Point
class UnPoint
{
private:
int x;
int y;
public:
UnPoint(int,int);
int GetAbscisse();
int GetOrdonnee();
};
//class rectangle
class UnRectangle
{
private:
int saLargeur;
int saLongueur;
UnPoint sonSommetHg;
public:
UnRectangle(UnPoint,int,int);
int GetLargeur();
int GetLongueur();
/* int estInclus(UnRectangle);*/
};
//constructeur du Point
UnPoint::UnPoint(int a,int b)
{
x=a;
y=b;
}
//constructeur pour le rectangle
UnRectangle::UnRectangle(UnPoint tel_SommetHG,int tel_largeur,int tel_longueur)
{
saLargeur=tel_largeur;
saLongeur=tel_longueur;
sonSommetHG=tel_SommetHG; //ici j ai pas utilisé un constructeur par recopie puisque je manipule pas des donnees dynamiques
}
int UnRectangle::GetLargeur()
{
return saLargeur;
}
int UnRectangle::GetLongueur()
{
return saLongueur;
}
int UnPoint::GetAbscisse()
{
return x;
}
int UnPoint::GetOrdonnee()
{
return y;
}
int main(int argc, char *argv[])
{ UnPoint A(1,2);
UnRectangle carree(A(1,2),4,2);
cout<<carree.GetLargeur();
cout<<carree.GetLongueur();
cout<<A.GetAbscisse()<<endl;
cout<<A.GetOrdonnee()<<endl;
system("PAUSE");
return EXIT_SUCCESS;
} |
Partager