Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 237327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:24:59+00:00 2026-05-11T20:24:59+00:00

This question was already asked in the context of C#/.Net . Now I’d like

  • 0

This question was already asked in the context of C#/.Net.

Now I’d like to learn the differences between a struct and a class in C++. Please discuss the technical differences as well as reasons for choosing one or the other in OO design.

I’ll start with an obvious difference:

  • If you don’t specify public: or private:, members of a struct are public by default; members of a class are private by default.

I’m sure there are other differences to be found in the obscure corners of the C++ specification.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:25:00+00:00Added an answer on May 11, 2026 at 8:25 pm

    You forget the tricky 2nd difference between classes and structs.

    Quoth the standard (§11.2.2 in C++98 through C++11):

    In absence of an access-specifier
    for a base class, public is assumed
    when the derived class is declared
    struct and private is assumed when the class is declared class.

    And just for completeness’ sake, the more widely known difference between class and struct is defined in (11.2):

    Member of a class defined with the
    keyword class are private by
    default. Members of a class defined
    with the keywords struct or union
    are public by default.

    Additional difference: the keyword class can be used to declare template parameters, while the struct keyword cannot be so used.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I´ve already asked this question at the comment section of the tutorial-site http://tympanus.net/codrops/2011/10/12/flexible-slide-to-top-accordion/ I
From searching SO, this question was already asked, almost a year ago now. So
If this question has already been asked I appologies, please point me in the
Searching here I found that this question was already asked , but I think
Edit : This question has already been asked and answered, and I apparently am
I've seen this question asked already - but none of the answers really gelled
I know that this question had already been asked a couple of times before,
It's possible that this question has already been asked, but I can't seem to
So I see that this question has already been asked, however the answers were
I've already asked this question on several forums, but without any good explanation of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.