Overriding a parameter

You can’t override a class parameter (or any parameter in SystemVerilog for that matter) with a dynamic variable. It must be another parameter, a literal constant, or some expression containing only these.

There are a few ways to achieve something close to what you are looking for if you can elaborate all the possible values of values that could be selected. (i.e. xyz_cfg.width could be 8,16,32,64)

You can create an associative array of proxy classes indexed by the elaborated values, then select the element you want to override with

class class_A #(int WIDTH) extends common_base;
...
endclass
uvm_object_wrapper class_A_proxies[int] = '{
                 5:class_A#(5)::get_type(),
                 8:class_A#(8)::get_type(),
                 16:class_A#(16)::get_type()
            }
...
commmon_base::type_id::set_type_override(class_A_proxies[xyz_cfg.width]);

See my popular DVcon paper for more details about parameters, constants, proxies and why you need a common_base class.

Another mechanism is to use a string lookup as described in another blog post of mine.