public class Human{ //Instanzvariablen private Name Name1; private Adress Adress1; //Konstruktor Human (Name KonsName, Adress Adress){ this.Name1 = KonsName; this.Adress1 = Adress; } //Copy-Konstruktor (Deep) erschafft neues gleiches Objekt Human (Human that){ Adress1 = new Adress(that.Adress1.getName(), that.Adress1.getNumber()); Name1 = new Name(that.Name1.getFirst(), that.Name1.getLast()); } /* //Shallow Copy hat gleiche Referenz Human (Human b){ this.Adress1 = b.Adress1; this.Name1 = b.Name1; } */ public String getName(){return Name1.getFirst() + Name1.getLast();} public String getAdress(){return Adress1.getName() + Adress1.getNumber();} public void greet(){System.out.println("Hallo, mein Name ist " + this.Name1.getFirst());} public void setFirst(String first){this.Name1.setFirst(first);} public void setLast(String last){this.Name1.setLast(last);} }