Created
March 8, 2013 09:56
-
-
Save erikdubbelboer/5115427 to your computer and use it in GitHub Desktop.
Constructor example
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
/* ~$ g++ test.c -o test | |
* ~$ ./test | |
* 12 | |
*/ | |
#include <stdio.h> | |
class Test { | |
public: | |
int example; | |
Test(int example) : example(example) { | |
} | |
}; | |
int main() { | |
Test test(12); | |
printf("%d\n", test.example); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment