If a constraint block is declared as static, then constraint mode on that block will effect on all the instancess of that class. In the following example, two objects obj_1 and obj_2 are declared. Constraints Var1_c is static and Var2_c is not static. When constraint_mode is used to switch off the constraints in in obj_2, constraint var1_c in obj_1 is also switched off.
program A_p_46;
A obj_1 = new;
A obj_2 = new;
initial begin obj_2.Var1_c.constraint_mode(0);
obj_2.Var2_c.constraint_mode(0);
repeat(10)
begin void'(obj_1.randomize());
$display("obj_1.Var1 : %d ,obj_1.Var2 : %d ",obj_1.Var1,obj_1.Var2);
end end endprogram