pragma solidity ^0.4.0;
//连续继承
//son 继承了bb; bb继承了yy,那么son就可以继承yy的属性和函数
contract yeye{
uint public gudong = 2000000;
function zhongdi() public returns(string){
return "zhongdi";
}
}
contract father is yeye{
uint public money = 10000;
function dahan() public returns(string){
return "dahan";
}
}
//son 这个合约继承了father合约
contract son is father{
//继承了father的money属性
function getmoney() public returns(uint){
return money;
}
//继承了father的dahan属性
function jichengbb() public returns(string){
return dahan();
}
function getgudong() public returns(uint){
return gudong;
}
function jichengyy() public returns(string){
return zhongdi();
}
}
32.Solidity-Inherit(继承)
于 2022-11-20 20:00:52 首次发布