0

What I understood from this is that if a function has virtual keyword, it can be overridden. And if a function has the keyword override means it is overriding another function. So, does the function below means it is overriding the function _burn and at the same time allowing itself to be overridden?

function burn(uint256 tokenId) public override virtual {
    _burn(tokenId);
}

1 Answer 1

0

Almost. It means there's another function named burn that is being overridden.
Whatever is inside this function is the new implementation, which in this case is the _burn function.

Everything else you mentioned is correct - virtual allows a function to be overridden, while override overrides an existing function with the same name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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