Why run_phase is virtual in driver class?

In reply to VK_18:

The “virtual” keyword of a function or task that allows polymorphism ability in OOP.
For example: Your base class has a function declare as virtual, now you want to change the behavior of that function, instead of modifying directly to the function, you can extend your base class, rewrite the function, and override to your base class.

Now, your question is: why we need “virtual” keyword before run_phase task in your project’s driver class (which is extended in uvm_driver class). The answer is: not necessary to have “virtual” keyword, because the run_phase task is always virtual implicitly, and your projects’ driver class always has polymorphism ability.

You can check easily, the uvm_driver is extended from uvm_component which has run_phase task declared as virtual.
According to LMR:

once a method has been identified as virtual, it shall remain virtual in any subclass that overrides it. In that case, the virtual keyword may be used in later declarations, but is not required.

That’s why the run_phase task of uvm_driver, your project’s driver class (extended from uvm_driver), so on… are virtual no matter you declare virtual keyword or not.