mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Update contracts.rst
I think it's more clear now and without the risk of mentioning the yet discussed accessor concept
This commit is contained in:
parent
ee51894e73
commit
01dc055d42
@ -194,16 +194,16 @@ return parameter list for functions.
|
|||||||
function setData(uint a) internal { data = a; }
|
function setData(uint a) internal { data = a; }
|
||||||
uint public data;
|
uint public data;
|
||||||
}
|
}
|
||||||
contract Caller {
|
contract D {
|
||||||
function readData(){
|
function readData(){
|
||||||
C c = new C();
|
C c = new C();
|
||||||
uint local = c.data(); // call accessor
|
uint local = c.data();
|
||||||
local = f(7); // error
|
local = f(7); // error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Other contracts can call ``c.data()`` to retrieve the value of data in state
|
An other contract ``D`` can call ``c.data()`` to retrieve the value of data in state
|
||||||
storage, but are not able to call ``f``. Contracts derived from ``C`` can call
|
storage, is not able to call ``f``. Contracts derived from ``C`` can call
|
||||||
``setData`` to alter the value of ``data`` (but only in their own state).
|
``setData`` to alter the value of ``data`` (but only in their own state).
|
||||||
|
|
||||||
.. index:: ! accessor;function, ! function;accessor
|
.. index:: ! accessor;function, ! function;accessor
|
||||||
|
Loading…
Reference in New Issue
Block a user