Access of Class method without creating Object

In reply to shanthi:

In reply to harsh pandya:
In the class methods you are not accessing any class properties and the methods are not virtual, so you can call those methods without creating objects.

Thanks for your feedback.

That, I know if we try to access class method which includes class property we meet to “Bad handle Reference” ( below example ).


// We got Error when we try to access method using b1.t() and object is not created.
class b;
  int x = 10;
  function int t (int a,b);
    $display("Class B -> a + b = %0d",(a+b+x));
    return a+b+x;
  endfunction : t
endclass : b

But, I want to know if class property not included in class method how it is working when object is not created.

But in case if you are accessing class properties inside the methods & if the methods are virtual then first we need to create the object before calling the methods

I am not sure this is related to virtual or non virtual. with virtual I am understanding method not present actually. So, if we try to access we got error.

Btw, can you provide any LRM reference for same.

Thanks
Harsh