Skip to Content
Mastering Blockchain Programming with Solidity
book

Mastering Blockchain Programming with Solidity

by Jitendra Chittoda
August 2019
Intermediate to advanced
486 pages
13h 52m
English
Packt Publishing
Content preview from Mastering Blockchain Programming with Solidity

Using variable and function visibility

Solidity state variables and functions should have visibility defined, along with their declaration. This visibility defines how a function and a state variable will be accessible from within the contract, as well as from outside of the contract.

There are four different visibility modifiers, that is, public, external, internal, and private, present in Solidity:

  • public: A function defined as public is accessible from both inside and outside of the contract. Solidity generates a getter function for public state variables, and these are also accessible from outside of the contract via these getter functions.
  • externalA function defined as external is only accessible from outside of the contract. Internally, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Ethereum

Mastering Ethereum

Andreas M. Antonopoulos, Gavin Wood
Complete Cryptocurrency and Blockchain Course | Learn Solidity

Complete Cryptocurrency and Blockchain Course | Learn Solidity

Ravinder Deol, Codestars By Rob Percival, Thomas Wiesner

Publisher Resources

ISBN: 9781839218262Supplemental Content