static void Main(string[] args) { var remoteControl = new RemoteControl(new SonyTV()); remoteControl.TurnOn(); remoteControl.TurnOff(); var advancedRemoteControl = new AdvancedRemoteControl(new SamsungTV()); advancedRemoteControl.TurnOn(); advancedRemoteControl.TurnOff(); advancedRemoteControl.SetChannel(1); Console.ReadKey(); }
static void Main(string[] args) { var remoteControl1 = new RemoteControl(new SamsungTv()); remoteControl1.TurnOn(); remoteControl1.TurnOff(); var remoteControl2 = new AdvancedRemoteControl(new SonyTv()); remoteControl2.TurnOn(); remoteControl2.SetChannel(2); remoteControl2.TurnOff(); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("############## Universal Control ###############"); Console.WriteLine(" TV "); Device device = new TV(); Console.WriteLine($"Volume : {device.Volume}"); RemoteControl remoteControl = new AdvancedRemoteControl(device); remoteControl.VolumeUp(); Console.WriteLine($"Volume changed: {device.Volume}"); remoteControl.TogglePower(); Console.WriteLine(" Radio "); device = new Radio(); Console.WriteLine($"Volume : {device.Volume}"); remoteControl = new AdvancedRemoteControl(device); remoteControl.VolumeUp(); Console.WriteLine($"Volume changed: {device.Volume}"); remoteControl.TogglePower(); }