diff options
author | chriseth <chris@ethereum.org> | 2018-05-08 16:44:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-08 16:44:08 +0800 |
commit | 506d82796d53f5548fafbb10c59a3d409f425090 (patch) | |
tree | 8bfc3ecf360d15de7c1a9ce571ec4c0063a797ba | |
parent | 0a63bc177b2871a0b0acb648e71360b44a12b290 (diff) | |
parent | a9f2936f27cb9adc236134e08bc97614cde32610 (diff) | |
download | dexon-solidity-506d82796d53f5548fafbb10c59a3d409f425090.tar dexon-solidity-506d82796d53f5548fafbb10c59a3d409f425090.tar.gz dexon-solidity-506d82796d53f5548fafbb10c59a3d409f425090.tar.bz2 dexon-solidity-506d82796d53f5548fafbb10c59a3d409f425090.tar.lz dexon-solidity-506d82796d53f5548fafbb10c59a3d409f425090.tar.xz dexon-solidity-506d82796d53f5548fafbb10c59a3d409f425090.tar.zst dexon-solidity-506d82796d53f5548fafbb10c59a3d409f425090.zip |
Merge pull request #4075 from elopio/docs/new-constructor
docs: update the explanation of constructor
-rw-r--r-- | docs/contracts.rst | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst index 5c298274..9d47b543 100644 --- a/docs/contracts.rst +++ b/docs/contracts.rst @@ -24,8 +24,8 @@ Creating contracts programatically on Ethereum is best done via using the JavaSc As of today it has a method called `web3.eth.Contract <https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#new-contract>`_ to facilitate contract creation. -When a contract is created, its constructor (a function with the same -name as the contract) is executed once. +When a contract is created, its constructor (a function declared with the +``constructor`` keyword) is executed once. A constructor is optional. Only one constructor is allowed, and this means overloading is not supported. @@ -982,7 +982,7 @@ virtual method lookup. Constructors ============ -A constructor is an optional function declared with the ``constructor`` keyword which is executed upon contract creation. +A constructor is an optional function declared with the ``constructor`` keyword which is executed upon contract creation. Constructor functions can be either ``public`` or ``internal``. If there is no constructor, the contract will assume the default constructor: ``contructor() public {}``. @@ -1139,7 +1139,7 @@ Example of a Function Type (a variable declaration, where the variable is of typ function(address) external returns (address) foo; -Abstract contracts decouple the definition of a contract from its implementation providing better extensibility and self-documentation and +Abstract contracts decouple the definition of a contract from its implementation providing better extensibility and self-documentation and facilitating patterns like the `Template method <https://en.wikipedia.org/wiki/Template_method_pattern>`_ and removing code duplication. .. index:: ! contract;interface, ! interface contract |