Is there a way in Solidity to call super class external functions?
Normally with inherited contracts, when overriding inherited functions you can also call the original function logic with super.functionName()
.
With external
functions, the only way to call them within the contract that defines them is with this.functionName()
.
Now what if I wanted to override an inherited external function and call the super class function, how would I achieve this if possible?
contract Foo {
// I want to call this from the contract that inherits it
function do() external virtual public {
// nothing
}
}
contract Bar is Foo {
function do() external public override(Foo) {
super.do() // TypeError: Member "do" not found or not visible after argument-dependent lookup in contract super Bar.
this.do() // revert
this.super.do() // Want to do something like this
}
}
virtual
parameter to the original function help (so it would befunction do() external virtual public
)? If it does, I can write it up as a proper answer.