static void Main(string[] args) { Trailer trailer = new Trailer(); Car citroenCar = new Car("Citroën", "Cactus", 2014); Console.WriteLine(citroenCar); citroenCar.attachTrailer(trailer); Console.WriteLine(citroenCar); trailer.fillTrailer("Hækkeaffald"); trailer.fillTrailer("Gl. Cykel"); Console.WriteLine(citroenCar); Car audicCar = new Car("Audi", "R8", 2008, "Sort", "AB12345", true); Console.WriteLine(audicCar); Console.WriteLine(citroenCar); Console.WriteLine("Trailer test"); trailer.fillTrailer("Hækkeaffald"); Console.WriteLine(trailer); trailer.fillTrailer("Gammel Cykel"); Console.WriteLine(trailer); }
static void Main(string[] args) { // lav et bil-objekt Car citroenCar = new Car("Citröen", "Cactus", 2015); Console.WriteLine(citroenCar); Trailer trailer = new Trailer(); citroenCar.attachTrailer(trailer); Console.WriteLine(citroenCar); trailer.fillTrailer("hækkeaffald"); trailer.fillTrailer("Gl. cykel"); trailer.fillTrailer("Trampolin"); trailer.fillTrailer("gl ost"); trailer.fillTrailer("fravær"); Console.WriteLine(citroenCar); Car audiCar = new Car("Audi", "R8", 2008, "Sort", "AB12345", true); Console.WriteLine(audiCar); }
public void attachTrailer(Trailer trailer) { this.trailer = trailer; }