2007年5月11日
摘要: Base class 和 Interface的使用,有时很容易判断,有时又很难区分。 1)二者的主要区别:Base class 体现了“IS A”的关系,而Interface体现的是“CAN DO”的关系。因为C#不允许多重继承(Multi-inherit),所以,如果派生的类不能正确的反映IS-A的关系,就不要使用基类;而如果不同的类或对象(Type)包含了同样的CAN-DO的功能,那么就用接口。另外,值类型(Value type)只能使用接口,不能使用Base Class; 阅读全文
posted @ 2007-05-11 15:19 Jack Niu 阅读(2119) 评论(1) 推荐(0) 编辑

Affiliate Marketing and Web Technology