更新时间:2022-05-30 23:00:12
由于默认的构造函数A是私人的,请尝试保护A(){}
的构造。
Because the default constructor for A is private, try protected A() {}
as the constructor.
类 B
自动调用 A
的默认构造函数,如果是无法访问乙
或没有默认的构造函数(如果你有构造保护A(字符串s){}
) B
不能正确实例。
Class B
automatically calls the default constructor of A
, if that is inaccessible to B
or there is no default constructor (if you have constructor protected A(string s) {}
) B
can not be instantiated correctly.
编译器会自动生成 B
public B() : base()
{
}
其中,基()
是默认的构造函数 A
的实际调用。
Where base()
is the actual call to the default constructor of A
.