A constructor is a special type of function whose functionality is to intialize the data members of a class at a time of object creation.so that it is also called automatic intialization of objects.
Read more →
Properties of a constructor:-
1.)It is invoked automatically at a time of the creation of object.so that the data members are intialized.
2.)It has neither return type nor void type.
3.)The name of a constructor and class should be identical.
4.)It should be declared on a public section.
Types of aconstructor:-
1.)Default Constructor.
2.)Copy Constructor.
3.)Parametrised constructor