Creating Specific coverpoint bins based on another fields - Functional Coverage

In reply to dave_59:

Thanks for the response Dave and ayehia

As per your suggestion, I decided to define the covergroup outside the class

covergroup cov1(ref bit[15:0] dest_addrs, input bit[15:0] valid_dest_addr); // CORRECT ???
                                           
  des_addr: coverpoint dest_addrs { addrs_bins[] = valid_dest_addr; }
endgroup : cov1

class es_monitor extends uvm_monitor;
  bit[7:0] seq_num;    // 256 values
  bit[15:0] dest_addrs;     // Out of 65536 values, only 256 are valid
  bit[15:0] valid_dest_addr[256];   // This array determines the valid 256 destination addresses
   // code....
endclass

When I’ve compiled above code, a compilation error is arising
valid_dest_addr : Invalid coverpoint/cross name specified in cover bin defintion

Is my covergroup definition correct?