Oops Program

C++ Program concept of Constructor

It is a rule that the class and the constructor function within it must have same names.This is how the compiler knows that the member function is a Constructor.Constructor is a member function that is executed automatically whenever an object is created so no return type is used for constructor Since the constructor is called automatically when an object is created, returning value would not make any sense.