August 2018
Intermediate to advanced
404 pages
11h 19m
English
If you want the function to be accessible both externally and internally, it has to be marked as public. Public state variables will generate a getter function automatically:
pragma solidity ^0.4.21;contract Visibility { // Public state variables generate an automatic getter uint public limit = 110021; // Accessible externally and internally function changeLimit(uint _newLimit) public { limit = _newLimit; }}
You can see the getter methods generated from the ABI output of this contract:
[{ "constant":false, "inputs":[{ "name":"_newLimit", "type":"uint256" }], "name":"changeLimit", // public function "outputs":[], "payable":false, "stateMutability":"nonpayable", "type":"function" },{ "constant":true, "inputs":[], "name":"limit", ...