1.

On which specifier’s data, does the size of a class’s object depend?(a) All the data members are added(b) Only private members are added(c) Only public members are added(d) Only default data members are addedI have been asked this question in examination.This intriguing question comes from Access Specifiers in section Access Specifiers of Object Oriented Programming

Answer»

Correct answer is (a) All the data members are added

The BEST explanation: All the data members are counted to calculate the size of an object of a class. The data member access specifier doesn’t PLAY any ROLE here. HENCE all the data size will be added.



Discussion

No Comment Found

Related InterviewSolutions