您当前的位置: 首页 >  bareape

solidity 中 关键字 this 的理解

bareape 发布时间:2022-03-14 11:17:31 ,浏览量:7

比如下面的代码中 this 指的就是 当前代码中 Score合约。

contract Score {
    mapping(address => uint256) score;
    address teacher;

    constructor() {
        teacher = address(new Teacher(address(this)));
    }
}

在当前合约内访问 external 定义的函数的时候需要使用 this 指针。

关注
打赏
1688896170
查看更多评论

bareape

暂无认证

  • 7浏览

    0关注

    23博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0368s