aeris

Héritage 2

Nov 5th, 2011
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. Maison(PorteBlindée porte) { this.porte = porte }
  18. ouvre() { this.porte.ouvre() }
  19. }
  20.  
  21. main() {
  22. new Maison(new Porte()).ouvre()
  23. new MaisonBlindée(new PorteBlindée()).ouvre()
  24. }
  25.  
  26.  
Advertisement
Add Comment
Please, Sign In to add comment