In reply to dave_59:
Sorry, I forgot to construct the a_3 in module check_task_2, Here I have rewritten a code:
class A;
task A_T(int p);
int b;
b = p;
#1;
$display("The value of b is %0d", b);
endtask
endclass
module check_task_2;
A a_3;
initial begin
a_3 = new();
fork
a_3.A_T(7);
a_3.A_T(10);
join
end
endmodule
Here, I am getting the output as suggested by you:
Compiler version S-2021.09; Runtime version S-2021.09; Nov 5 03:14 2022
The value of b is 7
The value of b is 10
V C S S i m u l a t i o n R e p o r t
Time: 1 ns
So the final conclusion is, everytime a task is called through an object handle, it will create a new memory for the task?