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); }
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(); }
private static void TurnOnTv(Television tv) { tv.TurnOn(); }