Constructor is a function, which has same name as class. It has no return type even void. It can have number of arguments according to the requirement. We do not need to call the constructor individually because when the object has created it automatically called.
Constructor is a function, which has same name as class. It has no return type even void. It can have number of arguments according to the requirement. We do not need to call the constructor individually because when the object has created it automatically called. It has used to initialize the object of the class or we can say to allocate memory space to the class. We can also initialize the data members of the class.
![]()
There are four types of constructor:
1. Default constructor:
It is a constructor, which has created by default when an object has initialized but it can also create by the user for requirement to initialize data members of the class.

2. Parametrized Constructor:
It is the constructor which can have number of parameter list when this type of constructor has created then it is required to create a default constructor has not created. The object without parameter cannot create.

3. Constructor Overloading:
It is the concept to create a constructor in different formats. This also knows as the concept of polymorphism where number of constructors has created in the class and can use according to the requirement.

4. Copy Constructor:
This concept is very useful to copy the values from one object to another object when it has used but we need to use the reference of one object from the second one.













11 Responses
nice article, very informing
Great Article
Thanks
Great article!
Interesting article, raman. Thank you.
Good info
This is a great resource. Thanks!
I like C++ too, but I’m not good. It’s hard to do. Have my liked it.
sweet article you really know your stuff
full of important information,
This is great…..
nice again