Advertisement
aeris

Héritage

Nov 5th, 2011
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  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. main() {
  16. new Maison(new Porte()).ouvre()
  17. new Maison(new PorteBlindée()).ouvre()
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement