Hi I want to understand the output of the below source code.
module abc();
class A;
int i;
function new(int i = 10);
this.i = i;
$display("This is from Parent class");
endfunction
endclass
class B extends A;
int i;
function new();
i = 20;
$display("This is from child class");
endfunction
endclass
initial
begin
B b_h;
b_h = new();
$display("%p",b_h);
end
endmodule
Output:
This is from Parent class
This is from child class
‘{super:’{i:10}, i:20}
Doubt: My doubt is how parent class new method is called to print that parent property i=10.