ITAsimo456

Dimostrazione

Aug 31st, 2020 (edited)
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. class Automobile {
  2. Pila<Persona> passeggeri;
  3. int npersone;
  4.  
  5.  
  6. Automobile() {
  7. passeggeri = Pila<Persona>(5);
  8. }
  9.  
  10.  
  11. void EntraPersona(Persona p) {
  12. if(npersone < 5) {
  13. passeggeri.Push(p);
  14. npersone++;
  15. }
  16. }
  17.  
  18. void EsciPersona() {
  19. if(npersone > 0) {
  20. npersone--;
  21. passeggeri.Pop();
  22. }
  23. }
  24. }
Add Comment
Please, Sign In to add comment