1.

All the data members of local class must be ___________(a) Defined with declaration(b) Defined in constructor(c) Declared and defined in constructor(d) Declared using a member functionI have been asked this question in class test.My question is from Local Class in chapter Class Members & Types of Object Oriented Programming

Answer» CORRECT answer is (b) Defined in constructor

For explanation: The data members FOLLOW the same rules as of simple classes. Hence the data members must be DECLARED first. Then their definition must be given using the CONSTRUCTORS.


Discussion

No Comment Found

Related InterviewSolutions