By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,778 Members | 1,947 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,778 IT Pros & Developers. It's quick & easy.

Size of blank class

P: 1
why size of blank class is 1?
Jun 11 '07 #1
Share this Question
Share on Google+
2 Replies


Banfa
Expert Mod 5K+
P: 8,916

weaknessforcats
Expert Mod 5K+
P: 9,197
In C++ a class with no data members has a sizeof 1 regardless of the number methods for the class. This permits you to create a pointer to an object of this class.

Should one of the methods be virtual you will see the size increase from 1 to 4 (32-bit OS) to allow you access to the VTBL for polymorphism.
Jun 11 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.