Set_type_override & set_type_override_by_type

I’m confused about these two function, I find some codes in our project like below :


initial begin

   uvm_factory::set_type_override_by_type(packet::get_type(),mypacket::get_type());
   packet::type_id::set_type_override(mypacket::get_type());
end

class test_inst extend test_base
   virtual function void build_phase(uvm_phase phase)
       super.build_phase(phase);
       set_inst_override("*.seqr.*","packet","packet_me");
endclass

Frist question :
what’s the diffrent between set_type_override & set_type_override_by_type ???

Second question:
Factory type override syntax is :<original_type>::type_id::set_type_override(<substitute_type>::get_type(), replace);
Why does our project code have not “replace” ??

In reply to L.D.2019:

They do the same thing. Don’t know why they had both. And set_type_override_by_type is not a static method, it probably was factory.set_type_override_by_type() where that needs an extra step to get a handle to the global factory.

Replace is unnecessary here, since both overrides are equivalent.

In reply to dave_59:

I got it.
Thank you for your explanation.