Dynamic casting in virtual sequence body method

The code given below is body method of virtual sequence. as m_sequencer is a handle of uvm_sequencer_base class which always exist for the uvm_sequence and when virtual sequence is start on the virtual sequencer (in test run_phase), start method internally does m_sequencer = virtual sequencer class handle, my doubt is why do we need to do $cast(v_seqr,m_sequencer) in virtual sequence body method ?
task body();
if(!$cast(v_sqr, m_sequencer)) begin
`uvm_error(get_full_name(), “Virtual sequencer pointer cast failed”);
end
bus = v_sqr.bus;
gpio = v_sqr.gpio;
endtask: body

In reply to Amarjit pradhan:

The code given below is body method of virtual sequence. as m_sequencer is a handle of uvm_sequencer_base class which always exist for the uvm_sequence and when virtual sequence is start on the virtual sequencer (in test run_phase), start method internally does m_sequencer = virtual sequencer class handle, my doubt is why do we need to do $cast(v_seqr,m_sequencer) in virtual sequence body method ?
task body();
if(!$cast(v_sqr, m_sequencer)) begin
`uvm_error(get_full_name(), “Virtual sequencer pointer cast failed”);
end
bus = v_sqr.bus;
gpio = v_sqr.gpio;
endtask: body

I think, the reason for casting is used to check the compatibility between v_sqr and m_sequencer.

In reply to Amarjit pradhan:

Virtual SEQR has physical sequencers in it, here BUS and GPIO SEQRs. These physical SEQRs cannot be accessed by handle m_sequencer of parent uvm_sequencer_base type. To access child properties child SEQR handle (here v_sqr) is needed.

task body();
  if(!$cast(v_sqr, m_sequencer))
    `uvm_error(get_full_name(), "Virtual sequencer pointer cast failed") // Semicolon here is a no-no

  // After casting only BUS and GPIO SEQRs are accessible.
  bus = v_sqr.bus;
  gpio = v_sqr.gpio;
endtask: body