What is the best way to inherit ERC721Enumerable?

Hi everyone. I'm new to Solidity.

I wanted to create a contract inheriting from ERC721Enumerable, and I wrote the code as TokenA.

However, OpenZeppelin Contracts Wizard shows as TokenB.

Why does the wizard's code use multiple inheritance? I don't see the benefit.

// My code
contract TokenA is ERC721Enumerable {
   constructor() ERC721("MyToken", "MTK") {}
}
// Wizard code
contract TokenB is ERC721, ERC721Enumerable {
   constructor() ERC721("MyToken", "MTK") {}

    function _beforeTokenTransfer(address from, address to, uint256 tokenId)
        internal
        override(ERC721, ERC721Enumerable)
    {
        super._beforeTokenTransfer(from, to, tokenId);
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(ERC721, ERC721Enumerable)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }
}

You're right, it's not required to inherit both since ERC721 is already inherited by ERC721Enumerable. Not sure why the wizard does so, but IMO less is more and so I only use ERC721Enumerable. If anyone knows of some best practices that recommend otherwise, then I'm happy to learn. :slight_smile:

Thank you for your answer. My confusion has been cleared up. I'll wait for more answers from others.:smiley: