Abstract Classes and constraints?

In reply to Mark Curry:
One quick terminology note: interface class are abstract, but not all abstract classes are interface classes. You can declare a virtual class with pure virtual methods as well as random variables and constraints as an abstract class. But I think your point is you’ve provided an API to set of private random variables, and the the constraint mechanism is not able to use the same API.

In general, the
randomize() with {} clause
is not an OOP-friendly construct. What you can do is create extensions to your concrete class that contain added constraints and construct the extensions in place of the concrete class object. You didn’t mention if you were using the UVM, but the UVM factory facilitates this class substitution.