Why having function in my class doesn’t change size of this class? This info must be stored somewhere, but where?
Share
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.
You can think of a member function as being just like any other function, except that it has an extra, hidden parameter that takes a pointer to the instance on which the member function was called.
For example, this:
might be implemented (at least conceptually) as:
If it was a const member function, then the hidden parameter would have the type
const C*instead. Note that the situation isn’t nearly this simple for virtual member functions.