virtual function test in cpp