diff options
author | Patrick Simianer <p@simianer.de> | 2014-06-14 16:46:27 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-06-14 16:46:27 +0200 |
commit | 26c490f404731d053a6205719b6246502c07b449 (patch) | |
tree | 3aa721098f1251dfbf2249ecd2736434c13b1d48 /ccc/class.cc |
init
Diffstat (limited to 'ccc/class.cc')
-rw-r--r-- | ccc/class.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/ccc/class.cc b/ccc/class.cc new file mode 100644 index 0000000..b493b51 --- /dev/null +++ b/ccc/class.cc @@ -0,0 +1,31 @@ +#include <iostream> + +using namespace std; + + +class A { + public: + A(int a):_a(a) {} + int geta() { + return _a; + } + static int _b; + private: + int _a; +}; + +int A::_b = 0; + +int main(void){ + A a(2); + A *b = new A(2); + cout << b->geta() << endl; + cout << b->_b << endl; + cout << a._b << endl; + A::_b = 42; + cout << b->geta() << endl; + cout << b->_b << endl; + cout << a._b << endl; + return 0; +} + |