Exemplo n.º 1
0
        static void Main(string[] args)
        {
            //MotoServiceDelegate @delegate = new MotoServiceDelegate(GoToService);
            MotoServiceDelegate @delegate = GoToService;
            // MotocycleService service = new MotocycleService(GoToService);
            MotocycleService   service   = new MotocycleService(@delegate);
            MyConsoleMotocycle motocycle = new MyConsoleMotocycle("Suzuki");

            motocycle.StartEngine();
            motocycle.Move(1000);
            motocycle.Move(5000);

            motocycle.StopEngine();
            motocycle = null;

            motocycle = new MyConsoleMotocycle("Suzuki");
            motocycle.StartEngine();
            motocycle.Move(6000);
            motocycle.StopEngine();
            motocycle = null;
            service   = null;
            motocycle = new MyConsoleMotocycle("Suzuki");
            service   = new MotocycleService(@delegate);
        }
Exemplo n.º 2
0
        public MotorcyleService(MotoServiceDelegate serviceDelegate)
        {
            _motoServiceDelegate = serviceDelegate;

            CheckDistance();
        }
Exemplo n.º 3
0
 public MotocycleService(MotoServiceDelegate motoServiceDelegate)
 {
     _motoServiceDelegate = motoServiceDelegate;
 }