Confused between $cast and factory override

In reply to UVM_LOVE:

Handle Types are

agent_a ;
uvm_agent ;
agent_b ;
agent_a ;

Am I right?

no, these are class Types which contains set of members and set of methods that operate on those members

agent_a_h,agent_b_h,temp : these are class variables where you store the class handles that references a particular class object of a particular class type
more info: A Short Class on SystemVerilog Classes - Verification Horizons