20120709-the key factor affecting explicit or implicit interface implementation
来源:互联网 发布:java action models 编辑:程序博客网 时间:2024/06/09 18:52
1. first situation:
one class implement one interface
and all the interface implementation is implicit
public interface IBankAccount { void PayIn(decimal amount); bool Withdraw(decimal amount); decimal Balance{get;} }
public class SaverAccount : IBankAccount { //类SaverAccount独有的 public void PayIn2() { } //接口IBankAccount可以访问的 public void PayIn(decimal amount) { }
//接口IBankAccount可以访问的 public bool Withdraw(decimal amount) { return false; } //接口IBankAccount可以访问的 public decimal Balance { get { return 1; } } }
when use IBankAccount
IBankAccount ba = new SaverAccount(); ba.PayIn(1); SaverAccount sa = new SaverAccount(); sa.PayIn(2); sa.PayIn2();//接口不能调用
2. the second situation
//the tiny difference is PayIn is explicit implementation //接口IBankAccount可以访问的 public void IBankAccount.PayIn(decimal amount) { }
//此时PayIn不可调用 sa.PayIn(2);
3. one class implement multiple interface
each interface can only invoke the member and function that is assigned by itself.
if the class explicit one interface's function, the instance of this class couldn't invoke the explicit interface fuction
- 20120709-the key factor affecting explicit or implicit interface implementation
- Implicit and Explicit Interface Implementation
- Explicit Interface Implementation
- The Difference Between Explicit and Implicit Grids
- explicit & implicit
- 显示接口成员实现(explicit interface member implementation)总结
- @interface,@implementation
- 显示实现和隐式实现接口的区别(Implicit and Explicit Interface Implementations)
- implicit和explicit
- explicit 和Implicit 区别
- c# sealed explicit implicit
- explicit和implicit关键字
- explicit和implicit
- implicit explicit测试
- Explicit, Implicit in FTPs
- C#中的显式接口成员实现(explicit interface member implementation)
- Five Dynamics Affecting the Wireless Manufacturing Market
- mysql触发器报错 1422 Explicit or implicit commit is not allowed in stored function or trigger.
- uva 375 - Inscribed Circles and Isosceles Triangles
- Oracle语句优化
- Android 之Adapter
- fastcgi
- 关于值类型和引用类型
- 20120709-the key factor affecting explicit or implicit interface implementation
- grep总结
- flex4 学习笔记-flex项目渲染器
- 关于堆和栈
- 一个计算机爱好者的不完整回忆(三十一)我的拼音输入法
- jQuery 获取鼠标坐标实现DIV更随鼠标显示
- tetris 1
- 利用 NSXMLParser 类解析 XML 文件时所遇到的问题
- PeopleEditor赋值操作(原创)