前言
接上一篇 https://blog.youkuaiyun.com/moon9999/article/details/106747444,本来想写在一起的,但是后来我想想还希望继续往前面补充,因此还是分成几次来写吧。
虚方法virtual
要点1:虚方法并不会影响方法的重载,无论是否定义为虚方法,均可重载;
要点2:重载时,无论是否为虚方法,均可以super父类的该方法;
class father;
int flow_id;
function new(int id);
$display("new father");
flow_id = id;
endfunction: new
virtual function vir_note();
$display("father vir_note");
endfunction: vir_note
function novir_note();
$display("father novir_note");
endfunction: novir_note
endclass: father
class son extends father;
function new();
super.new(30);
$display("new son, flow_id='d%0d", flow