diff options
author | chriseth <c@ethdev.com> | 2016-03-26 07:05:54 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-03-26 07:05:54 +0800 |
commit | 14d6b0b2d6b35013494e585fef6a88b3e3fa2b5e (patch) | |
tree | 1497c827a3c93bf1957dbe23a2a7247c04fc91eb | |
parent | 2c5641a1dbfdda4104176c7eb238891f99478664 (diff) | |
parent | 927a9710d5ce37c86ffc642b6cc39eeaed0e1efb (diff) | |
download | dexon-solidity-14d6b0b2d6b35013494e585fef6a88b3e3fa2b5e.tar.gz dexon-solidity-14d6b0b2d6b35013494e585fef6a88b3e3fa2b5e.tar.zst dexon-solidity-14d6b0b2d6b35013494e585fef6a88b3e3fa2b5e.zip |
Merge pull request #447 from ethereum/Initialize_Contract_with_Wei_call
Update frequently-asked-questions.rst
-rw-r--r-- | docs/frequently-asked-questions.rst | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst index db37a272..f960a0d6 100644 --- a/docs/frequently-asked-questions.rst +++ b/docs/frequently-asked-questions.rst @@ -613,6 +613,7 @@ Note that the full code of the created contract has to be included in the creato This also means that cyclic creations are not possible (because the contract would have to contain its own code) - at least not in a general way. + How do you create 2-dimensional arrays? ======================================= @@ -647,6 +648,22 @@ gas and return your 20 Wei). In the above example, the low-level function `call` is used to invoke another contract with `p.data` as payload and `p.amount` Wei is sent with that call. +How do I initialize a contract with only a specific amount of wei? +================================================================== + +Currently the approach is a little ugly, but there is little that can be done to improve it. +In the case of a `contract A` calling a new instance of `contract B`, parentheses have to be used around +`new B` because `B.value` would refer to a member of `B` called `value`. +You will need to make sure that you have both contracts aware of each other's presence. +In this example:: + contract B {} + contract A { + address child; + function test() { + child = (new B).value(10)(); //construct a new B with 10 wei + } + } + Can a contract function accept a two-dimensional array? ======================================================= |