UVM factory create in a class

In reply to dave_59:

Hi, thanks for the suggestion. I am unfortunately, still getting the same error :(

The error I am getting is

Error-[SV-ICA] Illegal class assignment
src/manager_test.sv, 26            
"this.m_child_manager = this.m_parent_manager.create_child();"
  Expression 'this.m_parent_manager.create_child()' on rhs is not a class
  or a compatible class and hence cannot be assigned to a class handle on lhs.
  Please make sure that the lhs and rhs expressions are compatible.

The line on 26 and line relevant to that is:


svt_manager m_parent_manager;
svt_manager m_child_manager;

function void build_phase(uvm_phase);
  ...
  // svt_manager extends parent_class
  m_parent_manager = svt_manager ::type_id::create("m_parent_manager", this, get_full_name());

  m_child_manager = m_parent_manager.create_child(); // Line 26
endfunction : build_phase

this error happens when my m_parent_manager is of type extended_class (in my specific case, it would be the svt_manager) , but there is no error if my m_parent_manager is of type parent_class (if I replaced all svt_manager with parent_class).

*NOTE: The class create_child actually returns a handle to the child object and doesn’t return void, so I would be returning the variable, child.

I tried your suggestion and it seemed to be on the right track but maybe my error is elsewhere?

(Also ,thanks for the $sformatf, that was actually a small known bug I had when I was thinking Python)