That code allow us to make labrary (Bibliotheque) that it has copy (Exemplaire) of books (oeuvre) when a call stocker(oeuvre , n) it has to stock a copy n time in put in a list "vector"
class Bibliotheque
{
private:
string nom;
Exemplaire exemplaire; // One "Exemplaire" has declared
vector<Exemplaire*> exemplaires { &exemplaire }; //list of pointers of "exemplaire"
public:
Bibliotheque(string nom)
:nom(nom)
{
cout << "La Bibliothèque " << nom << " est ouverte !" << endl;
}
string getNom()
{
return nom;
}
void stocker(Oeuvre &oeuvre, int n = 1)
{
for(int i = 0; i < n; i++)
{
exemplaires.push_back(&exemplaire); //It has to be list of the same object that have the same argument "oeuvre"
//making n time that object and put it in the list
}
}
};
Aucun commentaire:
Enregistrer un commentaire