I have been learning and working on Solidity for quite a while now. One thing that I have seen in many codes but did not understand was typecasting (looks like typecasting to me) of addresses to a contract type. When and why is this required ? A few example use cases with explanation would be really helpful. This is one of the codes that I found -
contract MyContract {
}
contract NewContract {
MyContract a;
function setMyContractAddress(address _contractAddress) {
a = MyContract(_contractAddress);
}
}
Please explain what is happening in the above code. Thank You for your time.