I have this interface:
pragma solidity ^0.4.24;
interface EventsInterface
{
function removeValueFromArray(uint _userId, uint[] array) external
returns(uint[]);
}
And this contract:
pragma solidity ^0.4.24;
import "./EventsInterface.sol";
contract EventsImpl is EventsInterface {
function removeValueFromArray(uint _userId, uint[] _array) internal returns(uint[]) {
uint[] storage auxArray;
for (uint i = 0; i < _array.length; i++){
if(_array[i] != _userId)
auxArray.push(_array[i]);
}
return auxArray;
}
}
When I try to deploy de contract. Remix report me a error:
This contract does not implement all functions and thus cannot be created.
Changing to public the Impl function:
function removeValueFromArray(uint _userId, uint[] _array) public returns(uint[]) {
uint[] storage auxArray;
for (uint i = 0; i < _array.length; i++){
if(_array[i] != _userId)
auxArray.push(_array[i]);
}
return auxArray;
}
I get the following error
TypeError: Function overload clash during conversion to external types for arguments
To fix the issue I set to public bouth functions (Interface/Implementation) and works. But I getting one warning that tell me that interface function must be external and not public
external
, hence their implementation (in a contract) must beexternal
too.