solidity/test/libsolidity/syntaxTests/inheritance/override/diamond_interface_intermediate_public_state_variable_and_function_implemented.sol

15 lines
540 B
Solidity
Raw Normal View History

interface I {
function f() external returns (uint);
}
contract A is I
{
uint public override f;
}
abstract contract B is I
{
function f() external virtual override returns (uint) { return 2; }
}
abstract contract C is A, B {}
// ----
// TypeError: (198-228): Derived contract must override function "f". Two or more base classes define function with same name and parameter types. Since one of the bases defines a public state variable which cannot be overridden, you have to change the inheritance layout or the names of the functions.