The interface is used to simplify the connection between DUT and Testbench. As the interface can’t be instantiated inside a class or program block, we need a virtual interface to point the physical interface.
So, the virtual interface is a pointer to the actual interface and using virtual interface, a class can point to different physical interfaces, dynamically (at run time).
In reply to Reuben:
Does it mean that by declaring the interface as virtual then all classes using that interface will obtain the same values?
For example, driver will put a value on the virtual interface, then the monitor will get the same value also.
Yes, using virtual interface, it is possible that the data driven by the driver is available to monitor, if the same instance of an interface is passed to both.