2

I have the following contract definition:

contract MyToken is StandardToken, Ownable {
  ...
  function transfer(address _to, uint256 _value) public returns (bool){
    require(...);

    // would like to call StandardToken's transfer function here
  }
}

I've tried doing:

function transfer(address _to, uint256 _value) public StandardToken(_to, _value) returns (bool) {

but that didn't work:

TypeError: Referenced declaration is neither modifier nor base class.

3

Your contract 'MyToken' is a child of 'StandardToken', it inherits the 'transfer' function. You do not need to define 'transfer' because you can already use it.

If you want to override the 'transfer' function, you can read about it here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.