A Developer's Diary

Feb 16, 2008

Synthesised Default Constructor

If we do not explicitly define constructors, then the compiler will generate the default constructor for us. The compiler-created default constructor is known as Synthesised Default Constructor.

It initializes each member using the same rules as are applied for variable initializations. Because the synthesised constructor does not automatically initialise the members of build-in type, we have to define the default Constructor explicitely. Bugs due to uninitialised variables can be hard to find.

Unitialised variables cause Run-Time problems as no compiler can detect all uses of uninitialised variables.

No comments :

Post a Comment