In reply to harry_torch:
Two problems with your approach: parameters can't be assigned with hierarchical references to other parameters, and you can't have hierarchical references to anything within a package (assuming your class is defined inside a package).
Something in your compilation script had to choose between the testbench that instantiates DUT_V1 or DUT_V2. That same script could choose between two packages that define global parameters for your verification environment. i.e.
// package for DUT_V1
parameter size = 1;
rand reg[ver_env::size - 1: 0 ] mem;
Even better would be if the DUT and testbench used the parameter from the same package.
Another option is to declare your mem with the maximum size, and then use a config_db variable to retrieve the actual size of the mem,