Created
July 9, 2019 13:07
-
-
Save ngmachado/1884b97875654d3aab240c5d1ec9cae9 to your computer and use it in GitHub Desktop.
Override Method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.5.0; | |
contract ObjectOriented { | |
event Debug(string msg); | |
constructor() public { | |
} | |
// Base method with two parameters | |
function A(address _addr, uint256 _value) public returns(uint256) { | |
assert(_addr == _addr); | |
emit Debug("Complete Params Methods Call"); | |
return _value; | |
} | |
// Sugar method that doesnt require address parameter | |
function A(uint256 _value) public returns(uint256) { | |
emit Debug("Encapsulated Method call"); | |
return A(address(this), _value); | |
} | |
} | |
contract Client is ObjectOriented { | |
function A(uint256 _value) public returns(uint256) { | |
return super.A(_value); | |
} | |
function A(address _addr, uint256 _value) public returns(uint256) { | |
return super.A(_addr, _value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment