Typecast fails in extended class which extends from base class

Hi,

Following is the dummy code. Actual code is very complicated as it contains lot’s of scripting and part of IP so can’t paste it here. But I am trying my best to replicate the same.

//TEST

class base_test extend uvm_test;
 protected my_base_class        base_class[1][2][3];
 `uvm_component_utils(base_test)

 task main_phase(uvm_phase phase);
  tmp_object = m_factory.create_object_by_name(seq_name);
  uvm_object  tmp_object;
  assert($cast(type[1][2][23], tmp_object));
 endtask
endclass

//BASE SEQUENCE
class my_base_class_c extends uvm_seq;
 //Some Functionality
endclass

class extended_class_c extends my_base_class_c;
 //Some Functionality
endclass 

The issue which I am facing is when I run base sequence my_base_class_c, the assert in the base test is working fine in casting the type. But Whenever I use a sequence that extends from the my_type sequence the casting fails, even though the extended class is extended from the base class itself. In the base sequence and extended sequence all are virtual functions and task. I am not sure what I am missing in concept which causing the assertion failure in type casting. It would be great if anyone please tell me what should I look for?

Regards

In reply to kritikagoell:

Your dummy example contains many typos, and any one of them could obscure the real problem. It would help getting the dummy code to execute, like I have below:

`define CTOR(n) `uvm_object_utils(n) \
function new(string name=`"n`"); \
endfunction

module top;
import uvm_pkg::*;
`include "uvm_macros.svh"
//BASE SEQUENCE
class my_base_class_c extends uvm_sequence;
  `CTOR(my_base_class_c);
 //Some Functionality
endclass
 
class extended_class_c extends my_base_class_c;
  `CTOR(extended_class_c)
 //Some Functionality
endclass 
class base_test extends uvm_object;
  `CTOR(base_test)
 protected my_base_class_c        base_class[1][2][3]; 
 task main_phase();
   uvm_object  tmp_object;
   uvm_factory m_factory = uvm_factory::get();
   tmp_object = m_factory.create_object_by_name("extended_class_c");
   assert($cast(base_class[0][1][2], tmp_object)); 
 endtask
endclass
  
base_test t = new;
  initial t.main_phase();
endmodule