开发者

What happens if you don't call the base constructor from the derived constructor?

Is it always necessary to call base class constructor from derived class constructor? What happens whe开发者_如何学Cn you don't call it?


Assuming you're talking about C++ (anyway, this should be similar in most other languages), if you don't call a constructor of the base class explicitly, its default constructor will be called automatically (if one exists; if not, the compiler would fire an error).


Nothing at all, since it's absolutely impossible not to do so.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜