From 6b562157bf50c515f5380ed659573aa40661fac7 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sat, 19 Dec 2015 00:44:44 +0100 Subject: c,cc: base-member --- c,cc/base-member.cc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 c,cc/base-member.cc diff --git a/c,cc/base-member.cc b/c,cc/base-member.cc new file mode 100644 index 0000000..4c3a86f --- /dev/null +++ b/c,cc/base-member.cc @@ -0,0 +1,32 @@ +/* + * template.cpp + * + * Patrick Simianer + * YYYY-MM-DD + */ + +#include + +using namespace std; + +class A +{ + public: + int a; +}; + +class B : public A +{ + public: + int b; +}; + +int main(int argc, char const* argv[]) +{ + B b; + b.b = 1; + b.a = 2; + cout << b.a << endl; + return 0; +} + -- cgit v1.2.3