Exemple #1
0
        //constructeur 2
        public lampe(string nom, string etat)
        {
            this.nom      = nom;
            this.etat     = etat;
            this.ampoule1 = new ampoule("ampoule 1", 40, "BON", "OFF");
            this.ampoule2 = new ampoule("ampoule 2", 40, "BON", "OFF");
            this.ampoule3 = new ampoule("ampoule 3", 40, "BON", "OFF");

            Console.WriteLine("Création de lampe (constructeur 1) : " + this.nom);
            Console.WriteLine("Création d'une lampe à l'état " + this.etat);
            nblampes++;
            Console.WriteLine("Nombre de lampe : " + nblampes);
        }
Exemple #2
0
        //constructeur 1
        public lampe()
        {
            this.nom      = "defaut";
            this.etat     = "éteint";
            this.ampoule1 = new ampoule("ampoule 1", 40, "BON", "OFF");
            this.ampoule2 = new ampoule("ampoule 2", 40, "BON", "OFF");
            this.ampoule3 = new ampoule("ampoule 3", 40, "BON", "OFF");

            nblampes++;
            Console.WriteLine("Création d'une lampe");
            Console.WriteLine("Création de lampe (constructeur 1) : " + this.nom);
            Console.WriteLine("Nombre de lampe : " + nblampes);
        }