Why are state variables private rather than public in OpenZeppelin Contracts?

You can find some explanation of visibility in this documentation: https://solidity.readthedocs.io/en/v0.7.4/contracts.html#visibility-and-getters, as for why create a function to access private variables, maybe in order to avoid exposing variables directly, and I think we should ask @abcoathup for a real reason.

1 Like