Skip to content

Instantly share code, notes, and snippets.

@AyDeveloper
Created August 9, 2022 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AyDeveloper/c96e280221713ebc0136e97a5b72484a to your computer and use it in GitHub Desktop.
Save AyDeveloper/c96e280221713ebc0136e97a5b72484a to your computer and use it in GitHub Desktop.
contract Parent {
function add(uint _a, uint _b) public pure returns (uint) {
return _a + _b;
}
function getBalance() public view returns (uint) {
return address(this).balance;
}
}
contract Child {
Parent newA = new Parent();
function getAdd(uint _a, uint _b) public view returns (uint) {
return newA.add(_a, _b);
}
function getBalance() public view returns (uint) {
return newA.getBalance();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment