Accessing base class function using derived class object/handle in systemverilog

In reply to rahulkumarkhokher@gmail.com:

You need to explain a lot more of what and why you want to do that, because you can’t do what your asking for directly.

If you don’t override a method in a derived class, you can still call that method in a base class.

class base;
   virtual function void f();
     // more code
   endfunction
   virtual function void g();
     // more code
   endfunction
endclass
 
class der extends base;
   virtual function void f(); // overrides base method
      // more code
      super.f();
      // more code
   endfunction
endclass
 initial begin
     der der_h;
     der_h = new;
     der_h.g(); // calls base class method
 end

If you want to be able to call a base class method that is overrided in a derived class object, you can create another method in the derived class that calls the base class method in the derived class.

class base;
   virtual function void f();
     // more code
   endfunction
endclass
 
class der extends base;
   virtual function void f(); // overrides base method
      // more code
      super.f();
      // more code
   endfunction
   function void f_base();
     super.f();
   endfunction
endclass
 initial begin
     der der_h;
     der_h = new;
     der_h.f_base(); // calls base method
 end