5

I read that the "send" function in Solidity can be overridden. Why would someone want to do that? Is that a way to avoid execution of the fallback function at the receiver?

6

The send function cannot be overridden, but it does call the callback at the receiving account, if there is code at that address.

There's no way to override this, and you shouldn't try - the fallback and the gas stipend exist to provide a way for accounts receiving funds to reject them, or to emit an event to log the transaction.

If you send value using send, the amount of gas provided is insufficient to cause dangerous reentrancy, if that's what you're concerned about.

0

I think what you read was talking about using a contract function with the name send() as bellow.

contract c{

    function send(){

    }}

this didn't override the built-in send. in solidity only inheritable properties of contracts could be overridden by derived contracts.

In the previous case in order to use the "built-in" send-function, you should use address(contract_instance).send(amount).

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.