C# Interface 接口
来源:互联网 发布:淘宝开店免费教程 编辑:程序博客网 时间:2024/04/30 19:15
C# Interface 接口
接口就是在有若干个类,但这些类中有某些功能相同,但实现不同的方法,这个时候把这些方法写成接口,然后在每个类中分别加以实现。
例子
public class UserModel{ public static int Exp;}public interface IUserData{ int Exp { get; }}public class Player : IUserData{ public int Exp { get { return 10+UserModel.Exp; } }}public class VipPlayer : IUserData{ public int Exp { get { return 20+UserModel.Exp; } }}
普通玩家 Player 和 VIP 玩家 VipPlayer 的 Exp 计算是不一样的
0 0
- C#接口Interface
- C#接口Interface
- C#接口Interface
- C#接口Interface
- C# interface 接口理解
- C# 接口使用 (interface)
- C#之接口(Interface)
- c# 接口interface 入门
- c# 接口 interface
- C# interface 接口理解
- C# Interface 接口
- C# 接口 interface
- C# 接口(Interface)
- C# 接口(Interface)
- C# interface(接口)
- 【C#学习】接口 Interface
- C#接口(Interface)
- C# 接口(Interface)
- 《Redis官方文档》 FAQ
- java后台框架源码 springmvc mybatis oracle mysql maven HTML5 bootstrap 全新技术
- RESULT CACHE
- gbk utf8 字符
- Python_批量修改文件的编码格式
- C# Interface 接口
- 在IE8下div高度问题
- linux shell用法(5)-- awk命令
- 微信开发四----实例代码分析
- K-means
- SpringMvc(Base64解密)上传
- 回望2015年看过的书,2016需要看的经典书
- KVO KVC Notification Delegate Block
- HTML5图片上传插件