DescriptionQ298
Q298DVDesignASIC interview problem
Field hiding and virtual dispatch
TechniquesSystemVerilogAdvanced OOP
DifficultyMedium
TopicSV
LanguageSystemVerilog
Format4 choices
01
Problem
What does the display print?
Class declarationSystemVerilog
class B;
int x = 1;
virtual function int f(); return x; endfunction
endclass
class D extends B;
int x = 2;
function int f(); return x; endfunction
endclass
B b; D d = new;
initial begin b = d; $display("%0d %0d", b.x, b.f()); end02
