internal 和 external
除 public
和 private
属性之外,Solidity 还使用了另外两个描述函数可见性的修饰词:internal
(内部) 和 external
(外部)。
internal
和 private
类似,不过, 如果某个合约继承自其父合约,这个合约即可以访问父合约中定义的“内部”函数。(嘿,这听起来正是我们想要的那样!)。
external
与public
类似,只不过这些函数只能在合约之外调用 - 它们不能被合约内的其他函数调用。稍后我们将讨论什么时候使用 external
和 public
。
声明函数 internal
或 external
类型的语法,与声明 private
和 public
类 型相同:
contract Sandwich {uint private sandwichesEaten = 0;function eat() internal {sandwichesEaten++;}
}contract BLT is Sandwich {uint private baconSandwichesEaten = 0;function eatWithBacon() public returns (string) {baconSandwichesEaten++;// 因为eat() 是internal 的,所以我们能在这里调用eat();}
}
internal 和 external相关推荐
- 【Windows10下.sh文件的运行】‘bash’ is not recognized as an internal or external command
问题描述 由于要下载数据集,需要在Win10下用bash指令. 但是在cmd直接运行,会出现'bash' is not recognized as an internal or external co ...
- Angular: ‘ng’ is not recognized as an internal or external command, operable program or batch file
今天,安装好 Angular CLI 框架后出现无法识别 ng 命令的情况.在网上搜了一些解决方案进行尝试后解决了这个问题.这里我将解决方案进行了整理,希望对看到这篇文章的小伙伴有所帮助. 问题描述 ...
- ‘vue-cli-service‘ is not recognized as an internal or external command
'vue-cli-service' is not recognized as an internal or external command 这个问题的解决方法. 1.在项目的根目录下直接运行npm ...
- python is not recognized_'python' is not recognized as an internal or external command
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: So I have recently installed Python Version 2.7 ...
- ‘python‘ is not recognized as an internal or external command
问题:安装pip时,在命令行窗口中运行python setup.py install报错'python' is not recognized as an internal or external co ...
- [乐意黎原创]npm run dev 时抛'cross-env' is not recognized as an internal or external command的解决方法
通过 Vue init webpack-simple 创建工程中, 运行 npm run dev 时抛以下错误, cross-env NODE_ENV=development webpack-dev ...
- Emotional Chatting Machine: Emotional Conversation Generation with Internal and External Memory翻译+笔记
情感化聊天机:结合内外记忆的情感对话生成 摘要 情感的感知和表达是对话系统或会话代理成功的关键因素.然而,到目前为止,这一问题还没有在大规模对话生成中得到研究.本文中,我们提出的情感聊天机(ECM)不 ...
- env-cmd is not recognized as an internal or external command
文章标题提到的错误消息,我觉得有点奇怪. 直接运行,不工作: 这个 env-cmd 实际是我 package.json 文件里定义的一个依赖库: npm install 安装依赖. 之后还是无法直接运 ...
- <Visual Relationship Detection with Internal and External Linguistic Knowledge Distillation>论文阅读
论文链接:论文 论文简介: 这是一篇CVPR2018的论文,主要针对的是Visual Relationship Detection任务.论文主要利用谓词及<object,subject>对 ...
最新文章
- php 动态分页,PHP动态分页函数,PHP开发分页必备啦
- 资源 | 一文读懂深度学习(附学习资源)
- 【编程之美】24点游戏
- spring ref historydesign philosophy
- 不同DPI下窗体的自适应的有关注意点(转)
- 吐血整理全网最全Spring面试题之高级篇(一)(共25题,附超详细解答)
- kettle执行组件时为什么使用克隆对象
- 每天一道算法题(10)——数对之差的最大值
- 《Entity Framework 6 Recipes》中文翻译系列 (24) ------ 第五章 加载实体和导航属性之查询内存对象...
- 智和信通围绕智和网管平台构建统一监控运维方案
- Java视频教程从入门到精通(2021完整版)
- rand()和srand()GetTickCount函数用法
- Android常用的 adb shell命令
- pyhton根据城市名称获取省份名称
- A4纸网页打印中对应像素的设定和换算
- CDS ORF 启动子 终止子 转录因子 基因结构 UTR
- LibreELEC 8.2.4:支持最新Raspberry Pi 3 Model B+
- 入网许可证_入网许可证怎么查询方法 入网许可证查询方法【图文演示】
- 脱离.Net Framework运行doNet程序的简单方法
- 损失函数focal loss深度理解与简单实现