Hi,
Here in this code, my_env acts as a uvm_component. In the add method of the uvm_heartbeat requires a component to add, so just for testing purpose we instantiated my_env as component & added in the heartbeat.add() method.
Thanks,
SANJAIKUMAR K