class Transaction;
...
some attributes
...
virtual function calc_something();
...
calculating something
...
endfunction
...
endclass
class BadTransaction extends Transaction;
...
some other attributes
...
function calc_something();
...
calculate something
...
endfunction
...
endclass
Transaction tr;
BadTransaction badTr;
initial begin
// case 1
tr = new();
tr.calc_something(); // Calls Transaction::calc_something
// case 2
badTr = new();
badTr.calc_something(); // Calls BadTransaction::calc_something
// case 3
tr = badTr; // base handle points extended object
tr.calc_something(); // What method will be called, the one from Transaction class or the one from BadTransaction?
end