Usage of type_id::create() vs factory::create_component

Hi.
I have seen in some papers, writers used

my_component inst_my_component;
string comp_name;
$cast(inst_my_component, create_component(“my_component”, comp_name));

i am not sure any difference or advantages over type_id::create()
namely:
inst_my_component = my_component::type_id::create(“inst_my_component”, this);

assume i already registered the my_component into factory.

thanks

The difference is that with type_id::create you get type checking at compile or elaboration time, whereas the $cast is a run-time type check.

In reply to dave_59:

hi dave ,

type_id::create();

here type_id refer to uvm_component type or my_component.

generally what is type_id?. it is object or variable.

type_id is accessing using scope resolution operator (i.e ::). scope resolution operator uses to access static members class. so is type_id is static in nature ?

please clarify this.

thanks

In reply to kbkdec15:

See Parameterized Classes, Static Members and the Factory Macros - Verification Horizons