Soldlity0.8-继承

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.3;
 
contract A {
     function foo() public pure virtual returns (string memory) {
         return "A";
     }

     function bar() public pure virtual returns (string memory) {
         return "A";
     }
     //more code here
    function baz() public pure returns (string memory) {
         return "A";
     }
}

contract B is A{
     function foo() public pure override returns (string memory) {
         return "B";
     }

     function bar() public pure virtual override returns (string memory) {
         return "B";
     }
     //more code here

}

contract C is B{
     function bar() public pure override returns (string memory) {
         return "C";
     }

 

posted @ 2022-08-03 11:08  ZaleSwfit  阅读(14)  评论(0编辑  收藏  举报