rbhangal
Newbie level 1
- Joined
- Apr 8, 2015
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 7
Each of these functions are in a separate derived class extending ... lets say uvm_test
In example 1, we use virtual when overriding an already virtual method, in example 2, we do not use the virtual keyword... I have seen examples both ways and no one seems to explain the usage of virtual in these specific cases. Is this a matter of style or is there a reason for using/not using the virtual keyword here? Can someone explain this to me? Thank you.
Code:
//example 1
class AAA extends uvm_test
//code...
virtual function void build_phase (uvm_phase phase)
//code...
endfunction
//code...
endclass
Code:
//example 2
class BBB extends uvm_test
//code...
function void build_phase (uvm_phase phase)
//code...
endfunction
//code...
endclass
In example 1, we use virtual when overriding an already virtual method, in example 2, we do not use the virtual keyword... I have seen examples both ways and no one seems to explain the usage of virtual in these specific cases. Is this a matter of style or is there a reason for using/not using the virtual keyword here? Can someone explain this to me? Thank you.