1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

question about empty class

Discussion in 'C++' started by Alex, Apr 12, 2009.

  1. Alex

    Alex New Member

    Oct 1, 2006
    Likes Received:
    Trophy Points:
    I once read from some text book that an empty class like:
    class A {};
    won't get 0 when the sizeof operator is applied to it. Usually the
    compiler would generate an internal char member for it (though
    accessing this member would be undefined behaviour) so that sizeof(A)
    would be 1. One reason to do this is to make sure no 2 objects of

Share This Page