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.
Search This BlogFeb 16, 2008Synthesised Default Constructor
Subscribe to:
Post Comments
(
Atom
)
|
No comments :
Post a Comment