summaryrefslogtreecommitdiff
path: root/tests/exec/field1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/exec/field1.cpp')
-rw-r--r--tests/exec/field1.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/exec/field1.cpp b/tests/exec/field1.cpp
new file mode 100644
index 0000000..09561e1
--- /dev/null
+++ b/tests/exec/field1.cpp
@@ -0,0 +1,22 @@
+#include <iostream>
+
+class A {
+public:
+ int x;
+};
+
+class B : public A {
+public:
+ int x;
+};
+
+int main() {
+ A *a = new A();
+ a->x = 0;
+ std::cout << a->x << "\n";
+ B *b = new B();
+ b->x = 1;
+ std::cout << b->x << "\n";
+ a = b;
+ std::cout << a->x << "\n";
+}