mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge the constructor sections
This commit is contained in:
parent
f8795afc70
commit
5f89e1a2ac
@ -20,6 +20,9 @@ Contracts can be created "from outside" or from Solidity contracts.
|
||||
When a contract is created, its constructor (a function with the same
|
||||
name as the contract) is executed once.
|
||||
|
||||
A constructor is optional. Only one constructor is allowed and this means
|
||||
overloading is not supported.
|
||||
|
||||
From ``web3.js``, i.e. the JavaScript
|
||||
API, this is done as follows::
|
||||
|
||||
|
@ -144,29 +144,6 @@ from web3 (inside geth or a web application). The main advantage of events
|
||||
is that they are stored in a special way on the blockchain so that it
|
||||
is very easy to search for them.
|
||||
|
||||
Do contract constructors have to be publicly visible?
|
||||
=====================================================
|
||||
|
||||
You can use the visibility specifiers, but they do not yet have any effect.
|
||||
The constructor is removed from the contract code once it is deployed,
|
||||
|
||||
Can a contract have multiple constructors?
|
||||
==========================================
|
||||
|
||||
No, a contract can have only one constructor.
|
||||
|
||||
More specifically, it can only have one function whose name matches
|
||||
that of the constructor.
|
||||
|
||||
Having multiple constructors with different number of arguments
|
||||
or argument types, as it is possible in other languages
|
||||
is not allowed in Solidity.
|
||||
|
||||
Is a constructor required?
|
||||
==========================
|
||||
|
||||
No. If there is no constructor, a generic one without arguments and no actions will be used.
|
||||
|
||||
Are timestamps (``now,`` ``block.timestamp``) reliable?
|
||||
=======================================================
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user