How can I change driver type in an agent, if both are extended from uvm_driver

Is there any way I can change the my_driver_1 type to my_driver_2? I guess factory override can’t be used as my_driver_2 is not an extended class of my_driver_1. Is this understanding correct. Is it possible to instantiate uvm_driver in the agent instead of my_driver_1

class my_driver_1 extends uvm_driver;
`uvm_component_utils(my_agent)
endclass

class my_driver_2 extends uvm_driver;
`uvm_component_utils(my_agent)
endclass

class my_agent extends uvm_agent
`uvm_component_utils(my_agent)
my_driver_1 drv;

drv = my_driver_1::type_id::create(this,“my_driver_1”) ;

endclass*

In reply to akhil_dv:

You can instantiate uvm_driver in releases after UVM 1.2 because none of the uvm_ classes were registered with the factory prior to that.

But it would be better to create your own driver base class to handle common procedures like setting up your virtual interfaces, etc.

In reply to dave_59:

Thank you so much, Dave. :)

In reply to dave_59:

In reply to akhil_dv:
You can instantiate uvm_driver in releases after UVM 1.2 because none of the uvm_ classes were registered with the factory prior to that.
But it would be better to create your own driver base class to handle common procedures like setting up your virtual interfaces, etc.

Hi Dave,
I didn’t understand what do you mean by instantiating the uvm_driver after UVM 1.2 . Can you please explain in more. Thanks in advance.

In reply to Manikanta Kopparapu:

In order to use the UVM factory, both the object you create by default (using the create() method), and the type you want overridden needs to be registered with the factory. In UVM 1.2, uvm_driver is not registered with the factory.