How to access member of parent sequence

In reply to cuonghle:
hi
As for #1 option(dynamic casting) i have attached a sample which i tried.
You need a type of parent to $cast isnt it, so for it to work with the forward referencing using typedef this will not work because of order of compilation or am i missing something.


typedef class v_seq;
  
class seq extends uvm_sequence #(seq_item);
  `uvm_object_utils(seq)
  
   seq_item req;
   v_seq p;
  
  function new(string name = "seq");
  super.new(name);
  // do_not_randomize = 1'b1; // Required for ModelSim
endfunction

  task body();
    m_parent_sequence.print();
    $cast(p,m_parent_sequence);
    $display("tx_cnt %d",p.tx_cnt);