今天看一下稍微复杂些的重载方式。
一 连续重载
文件:src/ch8/section8.2/8.2.3/consecutive/my_case0.sv
81 function void my_case0::build_phase(uvm_phase phase);
82 bird bird_inst;
83 parrot parrot_inst;
84 super.build_phase(phase);
85
86 set_type_override_by_type(bird::get_type(), parrot::get_type());
87 set_type_override_by_type(parrot::get_type(), big_parrot::get_type());
88
89 bird_inst = bird::type_id::create("bird_inst");
90 parrot_inst = parrot::type_id::create("parrot_inst");
91 print_hungry(bird_inst);
92 print_hungry(parrot_inst);
93 endfunction
输出结果如下: