Automatic variables inside static method

In reply to Nico75:

Hi Dave,

I am kind of totally getting lost/confused with the usage of static keyword at the left of a function/task. Yes I am clear with the fact that if we declare say a static var int a; or function static (); It creates a single location in stack memory and, all the objects share that same mem location and, the update by 1 object of the var int a will be seen across by all the objects.

But when it comes to Static on the LHS of a function/Task I am still not very clear.This is what I know of that “Static written at left implies to lifetime of method with respect to class and it is associated with class type, not with object. It is a method of class type, not of an instance of a class object”.

But as you would know this static method can be accessed by anyone outside without creating a class object using the scope resolution operator. So say we declare 2 class objects of class X and, we try to access the method (function f). set the var int a to some value using 1st object and, to another value using 2nd object. Now what will the value be returned when we try to access it using scope resolution X::f(). Can you please kindly explain what may happen here ?

I have seen your System verilog OOP course for UVM it was very good :) I have a question on why we use the static function create method when trying to create the actual object from the factory when using the proxy class. My understanding regarding that is since we can directly call that method using scope resolution we use that and, so even if user creates wishes to create multiple objects for (accessing the create() method) it all will refer to the same single instance that can exist even without creating an actual instance. This helps in creation of the Singleton. My understanding might be flawed to an extent,
please kindly correct me if I am wrong.

Thanks.