A variable is internal by default. However, its visibility can be overridden with private or public visibility specifiers.
Here are the visibility specifiers in Solidity:
- private:
- Can be read from and written to only within the contract it has been declared in
- public:
- Can be read from any contract but written to only within the contract it has been declared in and the children of that contract
- internal:
- Can be read from and written to only within the contract it has been declared in and the children of that contract
- The default visibility