比如下面的代码中 this 指的就是 当前代码中 Score合约。
contract Score {
mapping(address => uint256) score;
address teacher;
constructor() {
teacher = address(new Teacher(address(this)));
}
}
在当前合约内访问 external 定义的函数的时候需要使用 this 指针。
比如下面的代码中 this 指的就是 当前代码中 Score合约。
contract Score {
mapping(address => uint256) score;
address teacher;
constructor() {
teacher = address(new Teacher(address(this)));
}
}
在当前合约内访问 external 定义的函数的时候需要使用 this 指针。