Difference :: obj.get_type vs obj::get_object_type

Hi Dave Rich :
in a seperate topic ( sorry, i dont remember where i saw it), you mentioned to use :
if ( obj.get_type() == obj::get_object_type()) to check if the obj_type is “is_a” relation with base_object_type below. Could you elaborate it ?
I understand the different between static function and no_static function, but dont understand the idea behind above IF statement.

    class obj_type extends base_obj_type;
       ....
    endclass

    obj_type obj;
    obj = obj_type::type_id::create("obj", this );
    if ( obj.get_type() == obj::get_object_type()) 
           is_a relation with base_obj_type; 

thanks
andrew

( obj.get_type() == obj_type::get_object_type())

returns true if obj holds a handle to an object that is a obj_type.

The difference is that get_type() is a virtual method. If obj holds a handle to an object whose class type is an extension of the obj_type class type, it will return the extended class type.

Note that obj_type::get_object_type() and obj.get_object_type() are equivalent calls to a static method.

Hi Dave,

As per the source code, get_type is static and get_object_type is virtual.

define m_uvm_object_registry_internal(T,S) \ typedef uvm_object_registry#(T,“S`”) type_id;
static function type_id get_type();
return type_id::get();
endfunction
virtual function uvm_object_wrapper get_object_type();
return type_id::get();
endfunction