diff options
-rw-r--r-- | tests/core/test_polymorph.in | 8 | ||||
-rw-r--r-- | tests/core/test_polymorph.out | 4 |
2 files changed, 11 insertions, 1 deletions
diff --git a/tests/core/test_polymorph.in b/tests/core/test_polymorph.in index 1f24a1aa..af07dc05 100644 --- a/tests/core/test_polymorph.in +++ b/tests/core/test_polymorph.in @@ -16,6 +16,8 @@ struct Child : Parent { struct Other { int one() { return 11; } int two() { return 22; } + virtual int three() { return 33; } + virtual int four() { return 44; } }; int main() { @@ -24,10 +26,16 @@ int main() { printf("*%d,%d,%d,%d*\n", x->getit(), y->getit(), x->implme(), y->implme()); Other *o = new Other; + int (Other::*Ls)() = &Other::one; printf("*%d*\n", (o->*(Ls))()); Ls = &Other::two; printf("*%d*\n", (o->*(Ls))()); + Ls = &Other::three; + printf("*%d*\n", (o->*(Ls))()); + Ls = &Other::four; + printf("*%d*\n", (o->*(Ls))()); + return 0; } diff --git a/tests/core/test_polymorph.out b/tests/core/test_polymorph.out index 0d036bf0..5163ea8e 100644 --- a/tests/core/test_polymorph.out +++ b/tests/core/test_polymorph.out @@ -1,3 +1,5 @@ *11,74,32,1012* *11* -*22*
\ No newline at end of file +*22* +*33* +*44* |