【发布时间】:2011-05-01 07:08:43
【问题描述】:
我们知道我们不能创建abstract class 的实例。
我只想知道,如果我们创建抽象类的数组,它肯定会工作。
例如
public abstract class Creator
{
public abstract void DoSomething();
}
Creator creator = new Creator(); // this will give you compilation error!
Creator[] creator = new Creator[2]; // this will SURE work and will NOT give you compilation error.
谁能告诉我为什么会发生这种情况以及为什么它与数组初始化一起工作?
提前致谢。
【问题讨论】:
标签: c# oop design-patterns abstract-class