You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanna check the value of tokenCounter. Do I need to create a function which will return the value or I can access it directly with some predefined function present in the package?
contract AdvancedCollectible is ERC721 {
uint256 public tokenCounter;
constructor() public ERC721("Birds", "B") {
tokenCounter = 0;
}
function createCollectible(string memory tokenUri)
public
returns (uint256)
{
uint256 newTokenId = tokenCounter;
_safeMint(msg.sender, newTokenId);
_setTokenURI(newTokenId, tokenUri);
tokenCounter += 1;
return tokenCounter;
}
}
The text was updated successfully, but these errors were encountered:
Hello, @deepaklohmod6789.
As for solidity if you declare a variable public internally the language creates a get for it. Simply means you do not need an extra function to access the variable, just access it by name as you access the functions.
I wanna check the value of tokenCounter. Do I need to create a function which will return the value or I can access it directly with some predefined function present in the package?
The text was updated successfully, but these errors were encountered: