Guest User

Untitled

a guest
Jul 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. class AutoFabrik {
  2. public Auto ErzeugeAuto() {
  3. return new Auto(new Motor(), new Radio(), new Steuerung(???)); // <-- Wie soll ich das Objekt hier
  4. // ("???") schon übergeben,
  5. // wenn ich gerade mal dabei bin,
  6. // es zu initialisieren.
  7. }
  8. }
  9.  
  10. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  11.  
  12. class Auto {
  13. public Auto (Motor motor, Radio radio, Steuerung steuerung) {
  14. this.motor = motor;
  15. this.radio = radio;
  16. this.steuerung = steuerung;
  17. }
  18.  
  19. private Motor motor;
  20. private Radio radion;
  21. private Steuerung steuerung;
  22. }
  23.  
  24. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  25.  
  26. class Steuerung {
  27. public Steuerung(Auto auto) {
  28. this.auto = auto;
  29. }
  30.  
  31. private Auto auto;
  32. }
Add Comment
Please, Sign In to add comment