Creating new instances of a covergroup using an array

In reply to vsirsikar:

Hi Dave,
How about array of covergroup inside an interface?
I see it in apb_protocol_monitor_example (coverage cookbook) but when I try to compile code, an error is invoked:

APB_accesses_cg APB_protocol_cg[no_slaves];
              |
ncvlog: *E,SVNOTY (../protocol_monitor/apb_monitor.sv,140|14): Syntactically this identifier appears to begin a datatype but it does not refer to a visible datatype in the current scope.

And this is the code in apb_monitor.sv:

// Functional Coverage for the APB transfers:
//
// Have we seen all possible PSELS activated?
// Have we seen reads/writes to all slaves?
// Have we seen good and bad PSLVERR results from all slaves?
covergroup APB_accesses_cg();

option.per_instance = 1;

RW: coverpoint PWRITE {
  bins read = {0};
  bins write = {1};
}
ERR: coverpoint PSLVERR {
  bins err = {1};
  bins ok = {0};
}

APB_CVR: cross RW, ERR;

endgroup: APB_accesses_cg

// Array of these covergroups
APB_accesses_cg APB_protocol_cg[no_slaves];

Thanks,
P/S: sorry for my bad English