You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to be able to do the following inheritance structure:
// SPDX-License-Identifier: MIT-1.0pragma solidity^0.8.28;
interfaceA {
function FOO() externalviewreturns (uint256);
function bar() external;
}
abstractcontractB {
uint256public constant FOO =4;
}
contractCisA, B {
function bar() external {
//(...)
}
//(...)
}
Compiler currently does not like it:
TypeError: Derived contract must override function "FOO". 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.
--> Test.sol:12:1:
|
12 | contract C is A, B{
| ^ (Relevant source part starts here and spans across multiple lines).
Note: Definition in "A":
--> Test.sol:5:5:
|
5 | function FOO() external view returns (uint256);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: Definition in "B":
--> Test.sol:9:5:
|
9 | uint256 public constant FOO = 4;
|
The text was updated successfully, but these errors were encountered:
Abstract
I want to be able to do the following inheritance structure:
Compiler currently does not like it:
The text was updated successfully, but these errors were encountered: