Types in functions

The following code snippet is from LRM, section 8.25 (parameterized classes)

class stack #(type T = int);
local T items[];
task push( T a ); ... endtask
task pop( ref T a ); ... endtask
endclass

In the above case, I would like to push and pop methods to create variables of type T but I do not want to pass parameter “a”.
for example,

task push ;
  T x;
  $display ("%p \n", x);
endtask

is this allowed?

In reply to verif_learner:

Did you try it?