Calling build function explicitly

Hi,

I have a environment in which agent is created using $cast statement and then agent.build() is called.
So the query is since all the phases in OVM are called automatically and then why build of the agent is called explicity.
One of the reasons seems to be that the build function has been overridden.
But doesn’t know is it the exact reason.

For Example

In the build phase of the environment

virtual function void build();

 $cast(agent, create_component("agent_inst,....."));
 agent.build();     

endfunction

In reply to shankar_logic:

There’s not enough code shown to give you an answer. Are you sure the agent’s build() method is not being called twice by mistake?