Skip to content

Instantly share code, notes, and snippets.

@shingonu
Created December 11, 2018 16:40
Show Gist options
  • Save shingonu/2916263bf512315a3bde31d680cc49f6 to your computer and use it in GitHub Desktop.
Save shingonu/2916263bf512315a3bde31d680cc49f6 to your computer and use it in GitHub Desktop.
pragma solidity ^0.4.24;
contract A {
uint256 public a;
uint256 public b;
}
contract B {
uint256 public c;
uint256 public d;
}
contract C is A, B {
uint256 public e;
constructor() public {
a = 10;
b = 20;
c = 30;
d = 40;
e = 50;
}
}
@shingonu
Copy link
Author

pragma solidity ^0.4.24;

contract A {
    uint256 public a;
    
    function getValue() view external returns (uint256) {
        return a;
    }
}

contract B {
    uint256 public b;
    
    function getValue() view external returns (uint256) {
        return b;
    }
}

contract C is A, B {
    uint256 public c;
    
    constructor() public {
        a = 10;
        b = 20;
        c = 30;
    }
    
    function getValue() view external returns (uint256) {
        return c;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment