In reply to chr_sue:
You’re right about the syntax.
What you described won’t work in the case described because of the following code in the agent implemented for getting virtual interface
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
if(!uvm_resource_db#(virtual interface apb_interface)::get("apb_pkg", "vif", vif))
`uvm_fatal(get_type_name(), "Unable to get virtual interface");
endfunction: build_phase