Solved

24. Do methods affect to the size of an object?

Posted on 2015-01-24
2
51 Views
Last Modified: 2015-02-11
24. Do methods affect to the size of an object?
0
Comment
Question by:Nusrat Nuriyev
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 40568255
The answer is: No. No matter of how many methods a class has, the size is only determined by the data members.

With one notable exception: If you have only one method that is declared as 'virtual', the compiler will add a pointer to a Virtual Method Table, which will increase the class' size by 4 bytes (32bit) or 8 bytes (64 bits).
0
 

Author Comment

by:Nusrat Nuriyev
ID: 40604696
how can I see the content of virtual method table? is there any tool for developers?
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question