我试图编译如下(在坚实的) ..。
contract InfoFeed {
function info() payable returns (uint ret) { return 42; }
}
contract Consumer {
uint attribut = 0;
InfoFeed feed;
function setFeed(address addr) { feed = InfoFeed(addr); }
function callFeed() { attribut = feed.info.value(10).gas(800); }
}但我得到的是一条错误消息(在MIST的部署契约中):
Type function () returns (uint256) is not implicitly convertible to expected type uint256.
function callFeed() { attribut = feed.info.value(10).gas(800); }
^--------------------------^uint256怎么可能不能转换成uint256,请做些什么呢?
发布于 2016-12-07 10:05:37
尝试在gas(800)之后添加一对括号:
feed.info.value(10).gas(800)
变成了
feed.info.value(10).gas(800)()
错误信息试图告诉您的是,您告诉它将一个函数--一个返回(uint256)为特定的函数--分配给一个名为attribut的uint,当您需要调用该函数时,将调用它的结果分配给名为attribut的uint。
https://ethereum.stackexchange.com/questions/10539
复制相似问题