public Lampe(string nom, string etat) { this.nom = nom; this.etat = etat; this.ampoule1 = new ampoule("ampoule1", 40, "bon", "off"); this.ampoule2 = new ampoule("ampoule2", 40, "bon", "off"); this.ampoule3 = new ampoule("ampoule3", 40, "bon", "off"); nblampes++; Console.WriteLine("Lampe numero " + nblampes.ToString() + " : "); Console.WriteLine("La lampe est " + etat + " nom : " + this.nom); }
public Lampe() { nblampes++; this.nom = "défaut"; this.etat = "éteints"; this.ampoule1 = new ampoule("ampoule1", 40, "bon", "off"); this.ampoule2 = new ampoule("ampoule2", 40, "bon", "off"); this.ampoule3 = new ampoule("ampoule3", 40, "bon", "off"); Console.WriteLine("Lampe numero " + nblampes.ToString() + " : "); Console.WriteLine("La lampe est " + etat + " nom : " + this.nom); }