Skip to content

Instantly share code, notes, and snippets.

@cds-amal
Created July 8, 2023 15:47
Show Gist options
  • Save cds-amal/8c0788411348f8fbce8c9d26712e937a to your computer and use it in GitHub Desktop.
Save cds-amal/8c0788411348f8fbce8c9d26712e937a 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.20+commit.a1b79de6.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract A {
function foo() public pure returns (uint) { return bar(); }
function bar() public virtual pure returns (uint) { return 1; }
}
contract B is A { }
contract C is B {
// Q1 What is the output of C.main() ?
function main() public pure returns (uint) { return foo(); }
function bar() public override pure returns (uint) { return 2; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment