Can I use an extend class in function with an arguments?

In reply to chris_le:

Thanks @chris_le,
But I’ve got some unexpected output from the code as the below,


 Non-Virtual from A 
 Virtual from A 
 Non-Virtual from A 
 Virtual from EA 

I thought that it should be like


 Non-Virtual from A 
 Virtual from A 
 Non-Virtual from EA 
 Virtual from EA 

So, Would you please explain why do I get this result? and how to resolve this problem?