Monday, 9 June 2014

More about Constructors

                     Characteristics of Constructors

*They should be declared in the public section.
*They are invoked automatically when the objects are created.
*They do not have return types, not even void and they cannot return values.

*They cannot be inherited, though a derived class can call the base class constructor.
*Like other C++ functions, Constructors can have default arguments.
*Constructors can not be virtual.

*We can not refer to their addresses.

*An object with a constructor (or destructor) can not be used as a member of a union.

*They make ‘implicit calls’ to the operators new and delete when memory allocation is required.



.
They should be declared in the public section

No comments:

Post a Comment