From 8f1093f0e00f9b1df7ce343a879303fd56a95d08 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Tue, 29 Oct 2013 17:42:34 +0100 Subject: First commit. --- tests/exec/inheritance2.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/exec/inheritance2.cpp (limited to 'tests/exec/inheritance2.cpp') diff --git a/tests/exec/inheritance2.cpp b/tests/exec/inheritance2.cpp new file mode 100644 index 0000000..272b341 --- /dev/null +++ b/tests/exec/inheritance2.cpp @@ -0,0 +1,26 @@ +#include + +class A { +public: + virtual void f(); +}; + +class B : public A { +public: + void f(); +}; + +void A::f() { + std::cout << "this is A::f" << "\n"; +} + +void B::f() { + std::cout << "this is B::f" << "\n"; +} + +int main() { + A *a = new A(); + a->f(); + a = new B(); + a->f(); +} -- cgit v1.2.3