I have seen several examples, in the example they defined a contract shown below
contract ForeignToken {
function balanceOf(address _owner) constant returns (uint256);
function transfer(address _to, uint256 _value) returns (bool);
}
And in another contract, they used the previous defined ForeignToken.
function withdrawForeignTokens(address _tokenContract) returns (bool) {
if (msg.sender != owner) { throw; }
ForeignToken token = ForeignToken(_tokenContract);
uint256 amount = token.balanceOf(address(this));
return token.transfer(owner, amount);
}
I can't understand how the second contract could use the balanceOf and transfer function, since I assume the ForeignToken doesn't see implement any interface or has its own implementations.
the code example is seen in both
https://github.com/jkeesh/dogetoken/blob/master/contracts/contract.sol
and
https://etherscan.io/address/0xe531642e9bb5d027e9c20e03284287b97919a9a5#code