What happens if you do not call the base constructor from a derived constructor?

Is it always necessary to call the constructor of the base class from the constructor of the derived class? What happens if you do not name him?

+4
source share
2 answers

Assuming you're talking about C ++ (in any case, this should be similar to most other languages), if you don't call the base class constructor explicitly, its default constructor will be called automatically (if it exists, if not, the compiler should was to cause an error).

+9
source

Nothing, because it is absolutely impossible.

-1
source

All Articles