Constrain the number of occurrences in an array

In reply to Juhi_Patel:

Reason is your statement


  c_inst[i]= new(); 

There is no element of array c_inst yet .

Change your pre_randomize() to ::


function void pre_randomize();
    c_inst = new[10]; // 10 elements at default value 'null' 
    foreach(c_inst[i])  
    begin
      c_inst[i]= new();
      c_inst[i].randomize();  // Not Needed !!
    end
  endfunction