示例#1
0
        public static void Main()
        {
            IEletronicDevice TV = TVRemote.GetDevice(); //Is creating an object of new television

            PowerButton powBut = new PowerButton(TV);   //creating a new power button and injecting tv on it

            powBut.Execute();
            powBut.Undo();

            Console.ReadLine();
        }
示例#2
0
        IEletronicDevice device;//an instance of any deice modeled after that interface

        //constructor receive the device
        public PowerButton(IEletronicDevice device)
        {
            this.device = device;
        }