Created
July 3, 2016 21:26
-
-
Save olafurw/693edb5aed460cd9468d52184a406d95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Meow | |
{ | |
public: | |
Meow(); | |
int myWhateverValue; | |
const public: // const to the public, could also be "public const:" for parsing reasons | |
int myDelicateState; | |
}; | |
Meow::Meow() | |
: myWhateverValue(42) | |
, myDelicateState(2) | |
{ | |
} | |
int main() | |
{ | |
Meow meow; | |
int whatever = meow.myWhateverValue; // ok | |
const int cWhatever = meow.myWhateverValue; // ok | |
const int cDelicate = meow.myDelicateState; // ok | |
int delicate = meow.myDelicateState; // error | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment