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; }
原文地址:https://www.cnblogs.com/eilinge/p/10074210.html
时间: 2024-10-09 05:31:14