Created
April 2, 2022 15:23
-
-
Save Sohailghafoor/ff26b32e75385f9353cf803694563ec8 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
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
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity >=0.7.0 <0.9.0; | |
contract A { | |
event Log(string message); | |
function foo() public virtual { | |
emit Log("A.foo called"); | |
} | |
function bar() public virtual { | |
emit Log("A.bar called"); | |
} | |
} | |
contract B is A { | |
function foo() public virtual override { | |
emit Log("B.foo called"); | |
A.foo(); | |
} | |
function bar() public virtual override { | |
emit Log("B.bar called"); | |
super.bar(); | |
} | |
} | |
contract C is A { | |
function foo() public virtual override { | |
emit Log("C.foo called"); | |
A.foo(); | |
} | |
function bar() public virtual override { | |
emit Log("C.bar called"); | |
super.bar(); | |
} | |
} | |
contract D is B, C { | |
function foo() public override(B, C) { | |
super.foo(); | |
} | |
function bar() public override(B, C) { | |
super.bar(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment