0 votes 0 votes why did constructor's name is same as class name and it has no return type Object Oriented Programming cpp programming object-oriented-programming + – kd..... asked Mar 21, 2018 kd..... 346 views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply gauravkc commented Mar 21, 2018 reply Follow Share Constructors are used for object instantiation. It is like initializing the object created with the given values. You don't expect it to return anything. It just sets values (does groundwork specified in the constructor). It returns nothing. Not even void Constructor's name is same as the class name so that the compiler can distinguish it from other functions in that class. 1 votes 1 votes Salazar commented Mar 22, 2018 reply Follow Share agreed with @gauravkc just would like to rephrase "initializing the object created with the given values" as initializing the fields of the object with given values, after a constructor is invoked a space is created in memory for the object and initializes its fields 0 votes 0 votes Please log in or register to add a comment.