public static SystemSpeaker GetInstance() { if (_instnace == null) { _instnace = new SystemSpeaker(); } return(_instnace); }
static void Main(string[] args) { SystemSpeaker speker1 = SystemSpeaker.GetInstance(); SystemSpeaker speker2 = SystemSpeaker.GetInstance(); Console.WriteLine(speker1.GetVolume()); Console.WriteLine(speker2.GetVolume()); speker1.SetVolume(11); Console.WriteLine(speker1.GetVolume()); Console.WriteLine(speker2.GetVolume()); speker2.SetVolume(16); Console.WriteLine(speker1.GetVolume()); Console.WriteLine(speker2.GetVolume()); }