solidity语言6
映射
可以认为是哈希,格式 mapping(_KeyType => _ValueType)
pragma solidity ^0.4.0;
contract MappingExample {
mapping(address => uint) public balances;
function update(uint newBalance) public {
balances[msg.sender] = newBalance;
}
}
contract MappingUser {
function f() public returns (uint) {
MappingExample m = new MappingExample(); // 存储在memory
m.update(100);
return m.balances(this);
}
}
posted on
2018-02-28 11:48
北京涛子 阅读(
...) 评论(
)
编辑
收藏
转载于:https://www.cnblogs.com/liujitao79/p/8482820.html