Created
September 2, 2022 11:12
-
-
Save cleanunicorn/fb6462a4ca19091a663d797966d73833 to your computer and use it in GitHub Desktop.
The order of inherited contracts matters
This file contains 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.8.16; | |
contract BaseOne { | |
event ExecutedBaseOne(); | |
function overrideMe( | |
) public virtual { | |
emit ExecutedBaseOne(); | |
} | |
} | |
contract BaseTwo { | |
event ExecutedBaseTwo(); | |
function overrideMe( | |
) public virtual { | |
emit ExecutedBaseTwo(); | |
} | |
} | |
contract Instance is BaseOne, BaseTwo { | |
function overrideMe() | |
public | |
override( | |
BaseOne, | |
BaseTwo | |
) { | |
// Which one is called | |
// BaseOne.overrideMe() or BaseTwo.overrideMe() ? | |
super.overrideMe(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment