public static void Show() { var sonyRemoteControl = new AdvancedRemoteControl(new SonyTv()); sonyRemoteControl.TurnOn(); sonyRemoteControl.SetChannel(4); sonyRemoteControl.TurnOff(); var samsungRemoteControl = new AdvancedRemoteControl(new SamsungTv()); samsungRemoteControl.TurnOn(); samsungRemoteControl.SetChannel(4); samsungRemoteControl.TurnOff(); }
static void Main(string[] args) { // Khởi tạo một Điều khiển từ xa đa năng RemoteControl remote = new AdvancedRemoteControl(); // Điều khiển tivi, đang tắt, âm lượng là 5, kênh hiện tại là 5 remote.device = new Television("SAMSUNG Smart TV 4K UHD 55 inch", false, 5, 5); remote.Power(); (remote as AdvancedRemoteControl).Mute(); // Điều khiển radio, đang tắt, âm lượng là 4, kênh hiện tại là 1 remote.device = new Radio("Cassette Toshiba TY-CWU11", false, 4, 1); remote.Power(); remote.UpVolumn(); Console.ReadKey(); }