diff options
author | chriseth <c@ethdev.com> | 2016-11-22 00:09:08 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-11-22 00:12:33 +0800 |
commit | 73eb0235b4bb9673cf653ca834893e33f7410381 (patch) | |
tree | 9143b1a34ee2a5afe93fb39b40492e0e3614fc30 /docs | |
parent | 81eea45c2df6c29cd6e8c2258b10d44b9c058962 (diff) | |
download | dexon-solidity-73eb0235b4bb9673cf653ca834893e33f7410381.tar.gz dexon-solidity-73eb0235b4bb9673cf653ca834893e33f7410381.tar.zst dexon-solidity-73eb0235b4bb9673cf653ca834893e33f7410381.zip |
Fix examples and add explanation.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/types.rst | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/docs/types.rst b/docs/types.rst index 9f3b4dc1..1db35ced 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -312,6 +312,10 @@ If external function types are used outside of the context of Solidity, they are treated as the ``function`` type, which encodes the address followed by the function identifier together in a single ``bytes24`` type. +Note that public functions of the current contract can be used both as an +internal and as an external function. To use ``f`` as an internal function, +just use ``f``, if you want to use its external form, use ``this.f``. + Example that shows how to use internal function types:: pragma solidity ^0.4.5; @@ -385,7 +389,7 @@ Another example that uses external function types:: contract OracleUser { Oracle constant oracle = Oracle(0x1234567); // known contract function buySomething() { - oracle.query("USD", oracleResponse); + oracle.query("USD", this.oracleResponse); } function oracleResponse(bytes response) { if (msg.sender != address(oracle)) throw; |