Bitwise toggle coverage for a bitvector

In reply to dave_59:

Hi Dave,

I am new to coverage and also i might not have understood the question correctly.

But i was thinking can we use your code inside the class in following manner without using ref in the argument .

class coverage ;

bit [31:0] vector;

covergroup cg_active_tag_bit(input bit [31:0] position);
  pos: coverpoint (position & vector) !=0;
  option.per_instance = 1;
endgroup : cg_active_tag_bit

cg_active_tag_bit cg_active_tag_bits[32];

function new(); 
foreach (cg_active_tag_bits[i]) cg_active_tag_bits[i] = new(1'b1 << i);
endunction

function sample(input value);
this.vector =value;
foreach (cg_active_tag_bits[i]) cg_active_tag_bits[i].sample();
endfunction

endclass

Please correct me if am wrong.
Thanks in advance
rakshith