class avi;
int b;
static int c;
static function int kk();
int d;
d++;
return d;
endfunction
endclass
module max;
avi a;
initial repeat(3) begin
$display("%0d",a.kk());
end
endmodule
The new variable d inside the static method is not behaving like a static variable. why ?
Class methods always have an automatic lifetime. The variable d has an implicitly automatic lifetime.
The static method qualifier comes before the function keyword. This means the method may be called without constructing the class. Static methods must not reference class instance specific members (like b in your example).