接口

 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     }

 

posted @ 2020-09-22 13:34  技术不够脸来凑  阅读(69)  评论(0)    收藏  举报