93 lines
1.5 KiB
C++
93 lines
1.5 KiB
C++
#include <iostream>
|
|
#include <string>
|
|
#include <typeinfo>
|
|
using namespace std;
|
|
|
|
|
|
#ifndef FIGURES_HEADER
|
|
#define FIGURES_HEADER
|
|
|
|
class coloriable{
|
|
protected :
|
|
string couleur;
|
|
|
|
public :
|
|
coloriable();
|
|
coloriable(string coul);
|
|
string getCouleur();
|
|
void setCouleur(string coul);
|
|
};
|
|
|
|
class figure{
|
|
|
|
protected :
|
|
static int nb_instances;
|
|
|
|
public :
|
|
virtual float perimetre()=0;
|
|
virtual void afficherCaracteristiques()=0;
|
|
figure();
|
|
static int get_nbInstances();
|
|
};
|
|
|
|
class cercle : public figure , public coloriable{
|
|
private :
|
|
float rayon;
|
|
|
|
public:
|
|
cercle();
|
|
cercle(float rayon, string coul);
|
|
virtual void afficherCaracteristiques();
|
|
virtual float perimetre();
|
|
float get_rayon();
|
|
void set_rayon(float ray);
|
|
};
|
|
|
|
class polygone : public figure{
|
|
private :
|
|
int nb_cotes;
|
|
|
|
public:
|
|
polygone();
|
|
polygone(int nbc);
|
|
virtual void afficherCaracteristiques();
|
|
virtual float perimetre()=0;
|
|
|
|
};
|
|
|
|
class rectangle : public polygone{
|
|
protected :
|
|
float cote_1;
|
|
float cote_2;
|
|
public :
|
|
rectangle();
|
|
rectangle(float cot1, float cot2);
|
|
void set_cote_1(float cot1);
|
|
void set_cote_2(float cot2);
|
|
float get_cote_1();
|
|
float get_cote_2();
|
|
virtual float perimetre();
|
|
void afficherCaracteristiques();
|
|
};
|
|
|
|
class carre : public rectangle{
|
|
public :
|
|
carre();
|
|
carre(float cote);
|
|
void afficherCaracteristiques();
|
|
};
|
|
|
|
|
|
|
|
class triangle : public polygone{
|
|
protected :
|
|
float cote;
|
|
public :
|
|
triangle();
|
|
triangle(float cot);
|
|
void set_cote(float cot1);
|
|
float get_cote();
|
|
virtual float perimetre();
|
|
void afficherCaracteristiques();
|
|
};
|
|
#endif
|