Size of blank class

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sachinCplusplus
    New Member
    • Jun 2007
    • 1

    Size of blank class

    why size of blank class is 1?
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    read this http://www.thescripts.com/forum/show...hreadid=660463

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      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.

      Comment

      Working...