diff options
author | Patrick Simianer <p@simianer.de> | 2014-09-06 22:32:49 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-09-06 22:32:49 +0100 |
commit | 626c2cd921e7442c20ac1be7be0b9ecb44d00c95 (patch) | |
tree | d9bb1d4c670ffc3e6094202dc2d5764040c4c1ff /c,cc/copy_struct.cc | |
parent | 01215a3f542df6692ef12b4e4b5fed551d065545 (diff) |
cc examples
Diffstat (limited to 'c,cc/copy_struct.cc')
-rw-r--r-- | c,cc/copy_struct.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/c,cc/copy_struct.cc b/c,cc/copy_struct.cc new file mode 100644 index 0000000..cb23b09 --- /dev/null +++ b/c,cc/copy_struct.cc @@ -0,0 +1,36 @@ +#include <iostream> +#include <vector> + +using namespace std; + +struct C { + vector<int> i; +}; + +struct B { + C c; +}; + +struct A { + B b; +}; + +int +main(void) +{ + A a; + B b; + C c; + + c.i.push_back(23); + b.c = c; + a.b = b; + + cout << a.b.c.i[0] << endl; + + A x(a); + cout << x.b.c.i[0] << endl; + + return 0; +} + |