ERC721.sol
https://docs.openzeppelin.com/contracts/3.x/erc721#constructing_an_erc721_token_contract
Why are there 2 functions named _safeMint?
You can have multiple functions with the same name, as long as their signature is not the same.
Function parameters are also part of the signature, so the function signature of these two functions are different. Hence, they do not get mixed up in any way.
Whenever you call a contract function, you have to provide the parameters as well. The executed function is chosen based on the name and provided parameters.
The first function is just a shorthand version of the second hand, since it calls the second function.
it makes the "data" field optional by using overloading - if data is included, it'll use the 4-arg version, if it's not included, it'll call the three-arg version, which in turn just puts in an empty string for data calling the 4-arg version
Last updated