Think Different

Saturday, 26 July 2014

[C++] The difference between class and struct

class X {
    int a; // X::a is private by default
};

struct S {
    int a; // S::a is public by default
};

[note]: the variable in union is also public by default.



Ref. Working Draft, Standard for Programming Language C++

Posted by Ca at 09:02
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels: CPP

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Labels

  • 100 Songs Challenge (4)
  • Algorithm (1)
  • CPP (16)
  • Creative (18)
  • Math (4)
  • Music Theory (6)
  • Network (4)
  • Solidity (3)
  • Success (7)
  • Works (3)

Blog Archive

  • ►  2018 (5)
    • ►  Nov (3)
    • ►  Oct (1)
    • ►  Sept (1)
  • ►  2017 (16)
    • ►  Jul (4)
    • ►  Jun (6)
    • ►  Jan (6)
  • ►  2016 (3)
    • ►  Jun (1)
    • ►  May (1)
    • ►  Jan (1)
  • ►  2015 (2)
    • ►  Nov (1)
    • ►  Jan (1)
  • ▼  2014 (40)
    • ►  Dec (3)
    • ►  Nov (1)
    • ►  Aug (2)
    • ▼  Jul (4)
      • [C++] Why we need new/delete in C++? Can't malloc/...
      • [C++] Constructor/Copy Constructor/Assignment Oper...
      • [C++] The difference between class and struct
      • Jeff Bezos delivers graduation speech at Princeton...
    • ►  Jun (13)
    • ►  May (8)
    • ►  Apr (6)
    • ►  Mar (1)
    • ►  Feb (1)
    • ►  Jan (1)

About Me

My photo
Ca
View my complete profile

Markdown轉換

Powered by Blogger.