Skip to content

unnecessary virtual keyword #25

@yvesbou

Description

@yvesbou

To my understanding from what I've read in the documentation is the virtual keyword in the function header of _baseURI not needed.

It's only

Base functions can be overridden by inheriting contracts to change their behavior if they are marked as virtual

and

he overriding function must then use the override keyword in the function header.

However, if we were to inherit CryptoDevs once more, we would would need virtual.

If you do not mark a function that overrides as virtual, derived contracts can no longer change the behaviour of that function.

To my feeling, we should only focus on the syntax that is needed, as many beginners are not aware of such nuances, they copy paste this code for other projects as well and sets up not best practice.

/**
 * @dev _baseURI overides the Openzeppelin's ERC721 implementation which by default
 * returned an empty string for the baseURI
 */
 function _baseURI() internal view virtual override returns (string memory) {
     return _baseTokenURI;
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions