public void DriverControlBridgeTest()
        {
            IEngine          engine   = new StandardEngine(1300);
            StandardControls standard = new StandardControls(engine);

            standard.IngitionOn();
            standard.Accelerate();
            standard.Break();
            standard.IgnitionOff();

            SportControls sports = new SportControls(engine);

            sports.IngitionOn();
            sports.Accelerate();
            sports.AccelerateHard();
            sports.Break();
            sports.IgnitionOff();
        }
        static void Main(string[] args)
        {
            IEngine engine = new StandardEngine(1300);
            AbstractDriverControls controls = new StandardControls(engine);

            controls.IgnitionOn();
            controls.Accelerate();
            controls.Brake();
            controls.IgnitionOff();

            // Can use a different engine without changing the driver controls
            IEngine turbo = new TurboEngine(1300);

            controls = new SportControls(turbo);
            controls.IgnitionOn();
            controls.Accelerate();
            controls.Brake();
            controls.IgnitionOff();

            Console.Read();
        }
Exemple #3
0
    public static void Main()
    {
        IEngine engine = new StandardEngine(1300);
        StandardControls controls1 = new StandardControls(engine);
        controls1.IgnitionOn();
        controls1.Accelerate();
        controls1.Brake();
        controls1.IgnitionOff();

        // now use sporty
        SportControls controls2 = new SportControls(engine);
        controls2.IgnitionOn();
        controls2.Accelerate();
        controls2.AccelerateHard();
        controls2.Brake();
        controls2.IgnitionOff();
    }