So I discovered that solidity is generating automatic getter for public property. I was wondering why is not used more often, especially in ERC20 Contract. For example the default ERC 20 contract is using a specified getter for the decimals.
string private _name;
string private _symbol;
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
Why are they not using?
string public name
string public symbol
Am I missing something? Is it for security reasons? What are the advantages?
Many thanks in advance