Difference between type override and instance override?

Hi,

when to use type override and instance override?. how we decide which one to use?

I think, you can do type override when you want to replace all the instances where a particular class is used.

But when you need to override one particular instance of a class then you can use override by instance.

One example where you might use override by instance,
The scenario is:
You have 3 SPI interface. Where each is connected to a particular device.

In this case, you would have SPI agent for each of this interface. Now the env is all built based on SPI Agent for all of these 3 with unique names.
For a particular test, you would want to add a few more contraints or add some error scenarios in the driver (for only 1 of the 3 agents), then you need to ovverride by instance. Similarly if this error scenario generation is valid for all 3 agents then you can use override by type.

in the above example,
is the spi agent is single class used with different handles in env?

Yes. Unique name means unique instances/handles of the spi agents.