How to use config_db get() and set method to send array of interfaces?

In reply to UVM_SV_101:

I tried for loop but it does not work. I tried to set vif[0].val=0, vif[0].val=1 ,vif[0].val=2 . But it prints 2 for all values of val



virtual function void build_phase(uvm_phase phase);
     super.build_phase(phase);
     //if(!uvm_config_db#(virtual ram_if)::get(this, "", "vif", vif))
     //    `uvm_fatal(get_type_name, $sformatf("Did not receive ram_if"))
       for(int i =0; i<3; i++)begin
         uvm_config_db#(virtual ram_if)::get(this, "", "vif", vif[i]);
       end
     `uvm_info("ram_monitor", $sformatf("val[0] %d val[1] %d val[2] %d",vif[0].val,vif[1].val,vif[2].val),UVM_LOW);

// [ram_monitor] val[0]   2 val[1]   2 val[2]   2
   endfunction