1.

Which data members among the following are static by default?(a) extern(b) integer(c) const(d) voidI had been asked this question in semester exam.The origin of the question is Static Data Members topic in chapter Exception Handling & Static Class Members of Object Oriented Programming

Answer»

The correct choice is (c) CONST

For explanation: The const DATA members of any class are made STATIC by default. This is an implicit meaning given by the compiler to the member. Since const values won’t CHANGE from object to object, hence are made static instead.



Discussion

No Comment Found

Related InterviewSolutions