CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 20

Threaded View

  1. #2
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: structs verses classes? When to use them?

    [see clarification below...]
    In C++ the ONLY difference between a class and a struct is the default visibility after the opening brace:

    Code:
    struct myStruct
    {
    // Items placed right here are public
    }
    
    class myClass
    {
    // Items placed right here are private
    }
    Anything beyond this is simply a matter of style, and consistancy matter most.
    Last edited by TheCPUWizard; May 23rd, 2007 at 01:52 PM.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured