How to print the type of inheritance

Hi,
In the below code I want to print the type of the class from which newStack extends. I got a compilation error as below

“Expression T has no value.” in the display method


class newStack #(type T = stack#(int,10), string name = "pkt_stack") extends T;
  
  function void print_type();
    $display("this class is extended from type %0p, name of stack is %0s",T,name);
  endfunction:print_type
  
endclass:newStack

In reply to ram_88:
Use $typename(T)

In reply to dave_59:

Thanks Dave, It works. Below is the output given by the display statement

this class is extended from type “class{}UnitScopePackage_1::stack#([]bitS)” , name of stack is mini_stack

Could you help me understand about UnitScopePackage_1?

I have declared my newStack specialization as below, but the display output shows the type as stack#(bitS) why is it different from stact#(int,2)?

newStack#(stack#(int,2),“mini_stack”) s_h;

In reply to ram_88:

Classes with the same name can be declared in different scopes, including different compilation units ($unit). How each compilation unit gets a unique name is tool specific. Create string names for parameterized classes is also going to be tool specific. Please check your tool documentation or contact them directly.