Characteristics of constructors are below:-
- These are called automatically when the objects are created.
- All objects of the class having a constructor are initialized before some use.
- These should be declared in the public section for availability to all the functions.
- Return type (not even void) cannot be specified for constructors.
- These cannot be inherited, but a derived class can call the base class constructor.
- These cannot be static.
- Default and copy constructors are generated by the compiler wherever required.
- Generated constructors are public.
- These can have default arguments as other C++ functions.
- A constructor can call member functions of its class.
- An object of a class with a constructor cannot be used as a member of a union.
- A constructor can call member functions of its class.
- We can use a constructor to create new objects of its class and constructors cannot be virtual.