X-Git-Url: https://git.piment-noir.org/?p=TP_POO.git;a=blobdiff_plain;f=TP2%2FMain.java;h=229b6390ba4f5888c0384e0f9352fe8a7e50298e;hp=85c21fe2384a48564712366c5083c17db504b4ca;hb=3b61f2e62189aaffd275c808d957edbbb3eaae9f;hpb=22758baf926b8b833ce6a38566eb157e13fbd3fb diff --git a/TP2/Main.java b/TP2/Main.java index 85c21fe..229b639 100644 --- a/TP2/Main.java +++ b/TP2/Main.java @@ -100,7 +100,7 @@ class Main { public static void main4() { - Structure[] structure = new Structure[10]; + Compactable[] compactable = new Compactable[10]; Point p1 = new Point(1, 2); Point p2 = new Point(2, 7); @@ -126,22 +126,20 @@ class Main { liste.inserer(5); liste.inserer(4); - for (int i = 0; i < 10; i++) { - structure[i] = entier; - structure[i].afficher(); - structure[i].compacter(1); - structure[i].afficher(); - - structure[i] = liste; - structure[i].afficher(); - structure[i].compacter(1); - structure[i].afficher(); - - structure[i] = image; - structure[i].afficher(); - structure[i].compacter(1); - structure[i].afficher(); - } + compactable[0] = entiers; + entiers.afficher(); + compactable[0].compacter(1); + entiers.afficher(); + + compactable[1] = liste; + liste.afficher(); + compactable[1].compacter(1); + liste.afficher(); + + compactable[2] = image; + image.afficher(); + compactable[2].compacter(1); + image.afficher(); } public static void main(String[] args) {