Actually, the use of parent and child might be correct here.
But you’ve only shown one declaration of the variable x in the parent_base class, which is what local::x would refer to. There is no x in the child or child_base class shown.
Also, you are calling child_h.randomize(); the parent_c constraint is not active.
So the constraint x == local::x is always true because both sides are referencing the same variable.
Constraints are only active on the object for which the randomize() call is made on. If, instead, you had called this.randomize() and made child_h a rand variable, then the parent_c constraint would have been active.