Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class AutoFabrik {
- public Auto ErzeugeAuto() {
- return new Auto(new Motor(), new Radio(), new Steuerung(???)); // <-- Wie soll ich das Objekt hier
- // ("???") schon übergeben,
- // wenn ich gerade mal dabei bin,
- // es zu initialisieren.
- }
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
- class Auto {
- public Auto (Motor motor, Radio radio, Steuerung steuerung) {
- this.motor = motor;
- this.radio = radio;
- this.steuerung = steuerung;
- }
- private Motor motor;
- private Radio radion;
- private Steuerung steuerung;
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
- class Steuerung {
- public Steuerung(Auto auto) {
- this.auto = auto;
- }
- private Auto auto;
- }
Add Comment
Please, Sign In to add comment