Scope of Variables
Scope of local variables is limited to function in which they are defined but State variables can have three types of scopes.- Public − Public state variables can be accessed internally as well as via messages. For a public state variable, an automatic getter function is generated.
- Internal − Internal state variables can be accessed only internally from the current contract or contract deriving from it without using this..
- Private − Private state variables can be accessed only internally from the current contract they are defined not in the derived contract from it.
Question / Answer
Internal : Those functions and state variables can only be accessed internally (i.e. from within the current contract or contracts deriving from it), without using this .
Private : Private functions and state variables are only visible for the contract they are defined in and not in derived contracts.
Private : Private functions and state variables are only visible for the contract they are defined in and not in derived contracts.
Bibliography/References
- None