what are the properties of constructors in c++


Properties of constructors:
  1. They should be declared in public section of a class.
  2. They are invoked automatically when the object is created.
  3. They do not have return types, not even void and therefore , they cannot return values.
  4. Constructors cannot be inherited, through a derived class can call the constructor of base class.
  5. Like other c++ functions, they can have default arguments.
  6. Constructors can not be virtual.
  7. We cannot refer to their address.
  8. An object with constructor cannot be used as a member of a union.
  9. They make implicit call to the operators new and delete when memory allocation is required.


0 Comments