I was working on checking my understanding on polymorphism with constraints. I wrote a sample code
class parent;
rand int unsigned a;
constraint a_c { a < 1000;}
function print();
$display("The randomized data is %d\n", a);
endfunction
endclass
class child extends parent;
constraint a_c { a > 50;}
endclass
module m;
child c = new();
initial begin
c.randomize();
c.print;
end
endmodule
The output was
The randomized data is 2567677
What is going wrong here?