Besides the normal explenation of being visible or not to derived classes, is their any other difference?
If you make it more visible, is it taking more or less memory, does it slow thing down or…?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Apart from the accessibility of members outside or to the derived classes, access specifiers might affect the object layout.
Quoting from my other answer:
Usually, memory address for data members increases in the order they’re defined in the class . But this order may be disrupted at any place where the access-specifiers (
private,protected,public) are encountered. This has been discussed in great detail in Inside the C++ Object Model by Lippman.An excerpt from C/C++ Users Journal,
Interesting, isn’t it?