示例#1
0
 void UseSmartPhone(SmartPhone smartPhone)
 {
     // Cannot access private property 'Name' here
     Console.WriteLine(smartPhone.Name);
     // Cannot access explicit implementation of 'IMp3Player.Play'
     smartPhone.Play();
     // You can send the phone to the method that accepts an IMp3Player though
     PlaySong(smartPhone);
     // This works fine. You are sure to get the Phone name here.
     Console.WriteLine(((IPhone)smartPhone).Name);
     // This works fine, since the Call is public in SmartPhone.
     smartPhone.Call();
 }