You're creating a state variable meta
cast as Type MetaCoin
. The compiler understands this Type by seeing the .sol
code for MetaCoin
, so meta
gets all the methods of a MetaCoin
contract.
You would accomplish that much with:
MetaCoin meta;
To be meaningful, it needs an address. Maybe it's already published, so a contract that wants to talk to it could get situated using an address passed to the constuctor.
function MyContract(address metaAddress) {
meta = MetaCoin(metaAddress);
}
This is allowed, because meta
is a MetaCoin
- both sides are cast as the same Type.
Or, maybe you want to deploy a new MetaCoin each time:
function newMetaCoin() returns(address newContract)
meta = new MetaCoin();
return(meta);
}
The return
works because contracts are directly convertable to Type address
. It's shorthand for return(address(meta));
Hope it helps.