Open In App

UGC-NET | UGC NET CS 2016 July – III | Question 37

Implicit return type of a class constructor is:
(A) not of class type itself
(B) class type itself
(C) a destructor of class type
(D) a destructor not of class type

Answer: (B)
Explanation: Truly, constructor doesn’t have any return type not even void.
However, as the definition of Constructor goes, it is used to initialize an object of the class. So implicitly, they return the current instance of the class whose constructor it is.
Therefore, Implicit return type of a class constructor is class type itself.

For more information Refer:C++ Classes and Objects
Option (B) is correct.
Quiz of this Question

Article Tags :