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.
精彩评论