public void LoadResponsabilityChain() { Vehicule monVehicule1 = new Vehicule("4x4"); Console.WriteLine("Impression description du vehicule 1"); Console.WriteLine(monVehicule1.DonneDescription()); Modele monVehicule2 = new Modele("mon modele", "mon nom"); Console.WriteLine("\nImpression description du vehicule 2"); Console.WriteLine(monVehicule2.DonneDescription()); Marque monVehicule3 = new Marque("ma desc1", "ma desc2", null); Console.WriteLine("\nImpression description du vehicule 3"); Console.WriteLine(monVehicule3.DonneDescription()); }
static void Main(string[] args) { ObjetBase myVehicule1 = new Vehicule("MonAuto"); Console.WriteLine(myVehicule1.donneDescription()); ObjetBase myModele1 = new Modele("Mondeo", "Comme en avait je ne sais plus qui"); ObjetBase myVehicule2 = new Vehicule(null); myVehicule2.Suivant = myModele1; Console.WriteLine(myVehicule2.donneDescription()); ObjetBase myVehicule3 = new Vehicule(null); ObjetBase myModele2 = new Modele(null, null); ObjetBase myMarque1 = new Marque("Ford", "depuis longtemps", "your Fordship"); myVehicule3.Suivant = myModele2; myModele2.Suivant = myMarque1; Console.WriteLine(myVehicule3.donneDescription()); Console.ReadLine(); }