From 626c2cd921e7442c20ac1be7be0b9ecb44d00c95 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sat, 6 Sep 2014 22:32:49 +0100 Subject: cc examples --- c,cc/copy_struct.cc | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 c,cc/copy_struct.cc (limited to 'c,cc/copy_struct.cc') 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 +#include + +using namespace std; + +struct C { + vector 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; +} + -- cgit v1.2.3