What is Constructor
A constructor is a special method of a class or structure that initializes a newly created object of that type. Whenever an object is created, the constructor is called automatically.
Name of constructor should be same as the name of the class. We define a method inside the class and constructor is also defined inside a class.
Example
class X { public: X(); // constructor for class X };