In reply to g.john:
Please see How polymorphism (virtual functons + inheritance )in systemverilog | Verification Academy