1.

Data members ________________ (C++)(a) Can be initialized with declaration in classes(b) Can be initialized only with help of constructors(c) Can be initialized either in declaration or by constructor(d) Can’t be initialized

Answer» The correct choice is (b) Can be initialized only with help of constructors

The explanation: The data members are not property of class, those are property of the instances of the class. And the memory for the data members are not reserved until a constructor is called. Hence we use constructors for their initialization after the memory is reserved.


Discussion

No Comment Found

Related InterviewSolutions