On which specifier’s data, does the size of a class’s object depend?

Đinh Yến

New member
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 added
 
Answer: a
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.
 

Tìm kiếm

Back
Top