【发布时间】:2011-02-25 02:04:58
【问题描述】:
public interface IMyInterface
{
int A { get; set; }
string S { get; set; }
}
public abstract class MyAbs : IMyInterface
{ }
public class ConcreteClass : MyAbs
{
/* Implementation of IMyInterface*/
}
是否可以像上面那样在抽象类中省略空实现? 如果是这样,怎么做?为什么?
【问题讨论】:
-
将代码放在代码段中
-
如果你的抽象类完全没有实现,那为什么还要它呢?为什么不使用接口?抽象类通常用于您提供部分实现的情况。
标签: c#-2.0