ethereum(以太坊)(基础)--容易忽略的坑(一)
2024-09-03 15:12:05
pragma solidity ^0.4.0; contract base{
address public _owner=msg.sender;
uint _a;
string internal _b ;
uint private _c;
//uint external _d;ParserError: Expected identifier but got 'external' function base() {
_a =10;
//uint _d public;Expected ';' but got 'public'
string _f;
} function getA() public view returns (uint){
return _a;
} function setA(uint c) internal{
_a=c;
} //modifier OnlyAdmin() private{Expected '{' but got 'private'
modifier OnlyAdmin(){
require(_owner == msg.sender);
_;
} function kill() OnlyAdmin() external{
setA(6);
this.getA();
selfdestruct(msg.sender);
}
}
contract base1 is base{
function getA() public view returns(uint){
//return _c;DeclarationError: Undeclared identifier. Did you mean "_a" or "_b"?
//return _b;Overriding function return types differ:覆盖函数返回类型不同
return _a;
}
function getE(){
this.kill();
this.getA();
//this.setA(20);Member "setA" not found or not visible after argument-dependent lookup in contract base1
}
} contract base2{ uint public _e;
function getE(){
//this.getA();Member "getA" not found or not visible after argument-dependent lookup in contract base2
}
}
//contract base2 is base1,base{ Linearization of inheritance graph impossible:继承图的线性化是不可能的
contract base3 is base,base1{
uint public _e;
}
最新文章
- iOS 图片压缩
- 获取不变的UDID-b
- Unity Skin Shader Optimized
- [Angular 2] Using Pipes to Filter Data
- Java学习——static关键字
- Backbone.js 为复杂Javascript应用程序提供模型(models)、集合(collections)、视图(views)的结构
- instanceof 是如何工作的
- centos7.2 配置内网ntp服务器进行时间同步
- [Arxiv1706] Few-Example Object Detection with Model Communication 论文笔记
- Python_lambda
- 自己写的C#三层代码生成器
- SpringBoot 从application.yml中通过@Value读取不到属性值
- faker模块
- oracle 11g数据库--创建表空间,创建用户,用户授权并指定表空间。
- 立FLAG-书单
- 将mongodb设置为windows服务
- Gym 101933
- Asp.net MVC中Html.Partial, RenderPartial, Action,RenderAction 区别和用法【转发】
- activiti自己定义流程之Spring整合activiti-modeler实例(七):任务列表展示
- 自己定义滑动删除item的ListView。
热门文章
- 【Linux】GDB程序调试
- std::string, std::wstring, wchar_t*, Platform::String^ 之间的相互转换
- matlab练习程序(广度优先搜索BFS、深度优先搜索DFS)
- visual studio code配置项
- 源码安装mysql,及主从同步
- python实现oracle数据泵导出功能
- tensorflow报错 Key Conv/biases not found in checkpoint
- UVA - 11488 前缀
- c#主窗体以及副窗体弹出
- 【洛谷P4342】[IOI1998]Polygon