Regarding Method Overriding / Polymorphism SystemVerilog

In reply to dave_59:

I have fixed my code. So when we do $cast(b,a), it should create a new object of ‘b’ and copy the contents of ‘a’ to ‘b’. Is that right?