接口
1 class Program 2 { 3 static void Main(string[] args) 4 { 5 //接口就是一个规范、能力。 6 } 7 } 8 9 public class Person 10 { 11 public void CHLSS() 12 { 13 Console.WriteLine("我是人类,我可以吃喝拉撒睡"); 14 } 15 } 16 17 public class NBAPlayer 18 { 19 public void KouLan() 20 { 21 Console.WriteLine("我可以扣篮"); 22 } 23 } 24 25 public class Student : Person,IKouLanable 26 { 27 public void KouLan() 28 { 29 Console.WriteLine("我也可以扣篮"); 30 } 31 } 32 33 public interface IKouLanable 34 { 35 void KouLan(); 36 }

浙公网安备 33010602011771号