Good questions @M.K!
The default visibility for state variables is internal
.
The default visibility for functions used to be public
in older versions of Solidity. However, there is no longer any default visibility for functions, and their visibility must be stated.
For either to be private, you need to specifiy private
.
Yes, if you want the state variable to be accessible for external contracts, dapp frontend interfaces AND from within the same contract… i.e. from EVERYWHERE.
If you just want it to be accessible for external contracts and dapp frontend interfaces BUT NOT from within the same contract OR from derived contracts, then you need to specifiy external
visibility.
This too can take a while to “get your head round”. It is a gradual awakening … as you learn and experiment more