SHOW:
|
|
- or go back to the newest paste.
1 | Porte { | |
2 | ouvre() { } | |
3 | } | |
4 | ||
5 | PorteBlindée : Porte { | |
6 | ouvre() { "Saisissez votre code" } | |
7 | } | |
8 | ||
9 | Maison { | |
10 | Porte porte | |
11 | Maison(Porte porte) { this.porte = porte } | |
12 | ouvre() { this.porte.ouvre() } | |
13 | } | |
14 | ||
15 | MaisonBlindée { | |
16 | PorteBlindée porte | |
17 | - | new Maison(new PorteBlindée()).ouvre() |
17 | + | Maison(PorteBlindée porte) { this.porte = porte } |
18 | - | } |
18 | + | |
19 | } | |
20 | ||
21 | main() { | |
22 | new Maison(new Porte()).ouvre() | |
23 | new MaisonBlindée(new PorteBlindée()).ouvre() | |
24 | } | |
25 | ||
26 |