Overriding the parameter in a package using virtual class

I thought a parameter within a virtual class in a package can be overridden. I define several structs in a package that needs to be used in multiple modules and was looking for a clean way of accomplishing it using virtual classes. Is there a better way to do this for synthesizable code? Please see a small example below.

package test_pkg;

   parameter X = 4;
   virtual class override_params #(parameter ARRAY_SIZE = 2);

      parameter XXX = 2*ARRAY_SIZE;

   endclass: override_params

endpackage

module test();
parameter NUM_MASTERS = 16;
import test_pkg::override_params#(.ARRAY_SIZE(NUM_MASTERS))::*;
//import test_pkg::*;


//synthesis off
initial
   begin
     $display (" X is %d\n", X);
     $display (" XXX is %d\n", XXX);
   end
//synthesis on    
endmodule

I was trying to use import to expose the parameters in the virtual class.

Thanks

Noel

In reply to noel:

I forgot to add that the statement

import test_pkg::override_params#(.ARRAY_SIZE(NUM_MASTERS))::*;

is not acceptable by the compiler.

In reply to noel:

You just need to write

import test_pkg::override_params

Then you can provide the override when referencing the class type

override_params#(.ARRAY_SIZE(NUM_MASTERS)) handle;

You can also create local specialized type

typedef test_pkg::override_params#(.ARRAY_SIZE(NUM_MASTERS)) overridden_params;
overridden_params h;

In reply to dave_59:

Thanks Dave, I will try this out and hopefully I can synthesize it because the synthesis tools claim they can synthesize class but I have not tried something like this.