Merge pull request #2870 from aarongoa/develop

Add payable constructor for `C` - #2869
This commit is contained in:
chriseth 2017-09-12 11:32:46 +02:00 committed by GitHub
commit fabf4accd3

View File

@ -237,16 +237,17 @@ creation-dependencies are not possible.
D newD = new D(arg); D newD = new D(arg);
} }
function createAndEndowD(uint arg, uint amount) { function createAndEndowD(uint arg, uint amount) payable {
// Send ether along with the creation // Send ether along with the creation
D newD = (new D).value(amount)(arg); D newD = (new D).value(amount)(arg);
} }
} }
As seen in the example, it is possible to forward Ether to the creation using the ``.value()`` option, As seen in the example, it is possible to forward Ether while creating
but it is not possible to limit the amount of gas. If the creation fails an instance of ``D`` using the ``.value()`` option, but it is not possible
(due to out-of-stack, not enough balance or other problems), an exception to limit the amount of gas.
is thrown. If the creation fails (due to out-of-stack, not enough balance or other problems),
an exception is thrown.
Order of Evaluation of Expressions Order of Evaluation of Expressions
================================== ==================================