正如我们所知,我们无法创建abstract class
的实例。C#抽象类,与数组初始化配合使用
我只想知道,如果我们创建抽象类的数组,它肯定会工作。
E.g.
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.
任何人都可以请让我知道为什么会发生这种情况,为什么它与数组初始化?
在此先感谢。