示例#1
0
        public static SystemSpeaker GetInstance()
        {
            if (_instnace == null)
            {
                _instnace = new SystemSpeaker();
            }

            return(_instnace);
        }
示例#2
0
        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());
        }