Can a function have both override and virtual?

    
     function initialize() public override virtual initializer {
         ERC165.initialize();
        _registerInterface(_INTERFACE_ID_ERC721);
     }
1 Like

Hi @gopher,

Yes. virtual means child contracts can override. override means that you are overriding the function from a parent contract.

Please see the Solidity documentation:
https://docs.soliditylang.org/en/v0.8.2/contracts.html?highlight=override#function-overriding

2 Likes