void pass(TestClass t)
{
t.test("abc","def");
}
When you do this, the object you are passing gets sliced into a TestClass
and its identity is lost, so it now behaves like a TestClass
and calls the method accordingly.
To Fix this you want to pass t
by reference as @Nick suggested, or (not recommended) by pointer. It will now retain its identity and call the appropriate function, as long as test
is marked virtual
Edit: fixed spliced -> sliced .. too much bioshock..