Hardware interview practice
Shallow copying
What value is printed?
Starting point
Question code
class Box; int v; endclass
class C; Box box; endclass
C a, b;
initial begin
a = new;
a.box = new;
a.box.v = 1;
b = new a;
b.box.v = 9;
$display("%0d", a.box.v);
endChoose one
Answer choices
- A. 1
- B. 9
- C. 0
- D. x
