Talk:Default constructor

Latest comment: 10 years ago by Korbateck-delta in topic Default constructor != Compiler-generated constructor

Generalize

edit

Needs to be generalized. Java also has default constructors. And what about VB or C#? --Uncle Ed 17:02, 16 November 2006 (UTC)Reply

Object They are clearly two different things. A default constructor is a type of nullary constructor, but a programmer could add a nullary constructor to the program him/herself and it wouldn't be a default constructor. —Preceding unsigned comment added by DisturbedNerd999 (talkcontribs)

C++

edit

In the case of C++, a default constructor can have parameters, so long as all the parameters have themselves default values. These are plainly not nullary constructors. —SlamDiego←T 21:52, 18 July 2009 (UTC)Reply

Default constructor != Compiler-generated constructor

edit

The article confuses a default constructor with a compiler-generated constructor. A default constructor is not necessarily generated by the compiler. If the programmer writes a constructor without arguments (or with arguments that all have default values), it is still a default constructor, but at the same time it is a user-defined constructor. The notions of user-defined vs compiler-generated constructors are orthogonal to default and non-default constructors. — Preceding unsigned comment added by Korbateck-delta (talkcontribs) 09:46, 4 April 2014 (UTC)Reply