Constructor is used to initializing objects of a class and allocate appropriate memory to objects . That is, it is used to initialize the instance variables of a class with a different set of values but it is not necessary to initialize.
Read moreWhat are constructors in?
In class-based object-oriented programming , a constructor (abbreviation: ctor) is a special type of subroutine called to create an object. It prepares the new object for use, often accepting arguments that the constructor uses to set required member variables.
Read more