Add test for automatic casting down in inheritance

This commit is contained in:
Jason Turner
2014-03-26 09:14:06 -06:00
parent 7fade8e841
commit 56b036052f
3 changed files with 19 additions and 2 deletions

View File

@@ -15,3 +15,12 @@ assert_equal(15, t.const_val);
t.val = 23;
assert_equal(23, t.val)
// test_derived_factory returns a TestDerivedType contained
// in a shared_ptr<TestBaseType>. This is testing our ability
// to detect that and do the down casting for the user automatically
// at runtime
var d := derived_type_factory();
assert_equal(t.derived_only_func(), 19);
assert_equal(d.derived_only_func(), 19);