Member "transfer" not found or not visible after argument-dependent lookup in address. _needer.neede

关于solidity 0.5.0中的transfer的修改:

官方中原话:

  • The address type was split into address and address payable, where only address payable provides the transfer function. An address payable can be directly converted to an address, but the other way around is not allowed. Converting address to address payable is possible via conversion through uint160. If c is a contract, address(c) results in address payable only if c has a payable fallback function. If you use the withdraw pattern, you most likely do not have to change your code because transfer is only used on msg.sender instead of stored addresses and msg.sender is an address payable.

意思就是 address分成了两个部分,一个是address 一个是address payable ,如果你用address 在交易方面的话,你要定义address 变量,需要在address后加payable。例如:address payable neederAddress;

 

不知道解释的明白不,下面是官方api 不懂的话你们自己看下。我也一个刚学区块链的小白。请大家多多指教。

https://solidity.readthedocs.io/en/v0.5.3/050-breaking-changes.html?highlight=address%20payable

 

 

你可能感兴趣的:(以太坊)