示例#1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            var tv = new Television();

            TurnOnTv(tv);
            TurnOnTurnable(tv);
            var mw = new Microwave();

            TurnOnMicrowave(mw);
            TurnOnTurnable(mw);
        }
示例#2
0
        static void Main(string[] args)
        {
            IElectronicDevice TV     = TVRemote.GetDevice();
            PowerButton       powbut = new PowerButton(TV);

            powbut.Execute();
            powbut.Undo();
            Television vol = new Television(80);

            if (vol is IElectronicDevice)
            {
                vol.VolumeUp();
                vol.VolumeDown();
            }
            else
            {
                Console.WriteLine("isnt electronic device");
            }


            Console.ReadLine();
        }
示例#3
0
 private static void TurnOnTv(Television tv)
 {
     tv.TurnOn();
 }