Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Want some information about Class Size

Want some information about Class Size

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ashishbhatt 0
    wrote on last edited by
    #1

    Hi All,, I want some information about size of class. I have tested one example like below... class A { }; I declared one class but there is no any params into this.But when I see its size using sizeof() fuction it shows 1 .So I want to know for what it stores one byte. Thanks in Advance.

    Ashish Bhatt

    R M 2 Replies Last reply
    0
    • A ashishbhatt 0

      Hi All,, I want some information about size of class. I have tested one example like below... class A { }; I declared one class but there is no any params into this.But when I see its size using sizeof() fuction it shows 1 .So I want to know for what it stores one byte. Thanks in Advance.

      Ashish Bhatt

      R Offline
      R Offline
      Rajasekharan Vengalil
      wrote on last edited by
      #2

      See:

      • http://groups.google.com/group/comp.lang.c++/browse_thread/thread/e16cb3f5c28d332a/cd46514ff8840fc8?hl=en&lnk=st&q=empty+class+1+byte+ranju#cd46514ff8840fc8[^]
      • http://groups.google.com/groups?sourceid=ie7&rls=com.microsoft:en&ie=UTF-8&oe=utf8&q=empty+class+size+1+byte&um=1&sa=N&tab=wg[^]

      -- gleat http://blogorama.nerdworks.in[^] --

      1 Reply Last reply
      0
      • A ashishbhatt 0

        Hi All,, I want some information about size of class. I have tested one example like below... class A { }; I declared one class but there is no any params into this.But when I see its size using sizeof() fuction it shows 1 .So I want to know for what it stores one byte. Thanks in Advance.

        Ashish Bhatt

        M Offline
        M Offline
        Mark Salsbery
        wrote on last edited by
        #3

        or from the man himself: Bjarne Stroustrup: Why is the size of an empty class not zero?[^]

        Mark Salsbery Microsoft MVP - Visual C++ :java:

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups