代码拉取完成,页面将自动刷新
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.16 <0.8.0;
contract TestModifire{
address public owner;
uint public num = 0;
constructor() public {
owner = msg.sender;
}
// 函数修饰符
// modifier修饰的方法不能对外公开,不能使用public关键字
modifier onlyOwner(){
require(msg.sender == owner,"no auth!");
_;
}
// 实际调用changeIt时,代码执时先跳转到 onlyOwner 方法进行执行,在onlyOwner方法内部遇到 _;时会回到changeIt方法,调用changeIt方法里的代码:
function changeIt(uint _num)public onlyOwner {
num = _num;
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。