【发布时间】:2010-03-31 20:59:51
【问题描述】:
我有一个类似的类结构
abstract class Animal {
public Animal(){
//init stuff..
}
}
class Cat : Animal {
public Cat(bool is_keyboard) : base() //NOTE here
{
//other init stuff
}
}
那么,看一下上面提到的那一行。如果您删除: base(),那么它将编译而不会出现错误。
这是为什么?有没有办法禁用这种行为?
【问题讨论】:
标签: c# inheritance constructor