예제 #1
0
 public void addCar(Car item)
 {
     if (!this.cars.Contains(item))
     {
         item.bindHandler(new ReportAccidentEventHandler());
         this.cars.Add(item);
     }
 }
예제 #2
0
        private static void testUpgrade()
        {
            Upgrade.Car iCar = new Upgrade.Car(2000, "Rover");
            Upgrade.House iHouse = new Upgrade.House(13000, "Becsi ut 103.");

            Upgrade.Person iPerson = new Upgrade.Person("Teszt Elek", 10);
            System.Console.WriteLine(iPerson);
            iPerson.addItem(iCar);
            iPerson.addItem(iHouse);
            System.Console.WriteLine(iPerson);

            Upgrade.Insurer iInsurer = new Upgrade.Insurer();
            iInsurer.addCar(iCar);

            iCar.accident(20);
            System.Console.WriteLine(iPerson);
            iHouse.addRoom(1500);
            System.Console.WriteLine(iPerson);
        }