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
   | class Video{
public:
	Video(std::string&& un_nom, size_t une_date,std::string&& nom_fichier, double une_duree):nom(un_nom),date(une_date),fichier(nom_fichier),duree(une_duree){};
	virtual void afficher(std::ostream&) const{};
private:
	const std::string& nom;
	size_t date;
	const std::string& fichier;
	double duree;
};
 
class Film : public Video
{
public:
    //Constructeur
    Film(std::string&& un_nom, size_t une_date,
         std::string&& nom_fichier, double une_duree, std::vector<std::string>& chapitre);
    //Accesseurs
    int nombreChapitres() const;
    virtual void afficher(std::ostream&) const;
    //Destructeur
    virtual ~Film(){}
 
	std::vector<std::string>& chapitres_;
 
};
 
Film::Film(std::string&& un_nom, size_t une_date,
           std::string&& nom_fichier, double une_duree, std::vector<std::string>& un_chapitre)
    : Video(std::string(un_nom), une_date, std::string(nom_fichier), une_duree),
      chapitres_(un_chapitre)
{
    std::cout << "Construction de la platforme de films " << std::endl;
}
 
int Film::nombreChapitres() const
{
    return chapitres_.size();
}
 
void Film::afficher(std::ostream& sortie) const
{
    Video::afficher(sortie);
    for(int i(0); i< chapitres_.size(); ++i)
    {
        sortie << "Chapitre " << i+1 << " :" << std::endl
               << chapitres_[i] << std::endl;
    }
} | 
Partager