Default constructor

From Wikipedia, the free encyclopedia

A default constructor is a constructor that can be called with no arguments. [1]

In C++ and Java, if (and only if) no constructors (default or non-default) are explicitly defined for a class, then the compiler will provide an implicit default constructor, which is equivalent to a default constructor which is blank. Therefore, a class is not guaranteed to have a default constructor. Some programmers explicitly create one as a matter of habit, so they won't forget later, but this is not required.

In C++, arrays only have a default constructor, which constructs each of its elements using the default constructor for their type. It is an error if that class does not have a default constructor.