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(); }
IEletronicDevice device;//an instance of any deice modeled after that interface //constructor receive the device public PowerButton(IEletronicDevice device) { this.device = device; }