Make createAndEndowD payable in contract creation example

This commit is contained in:
Aaron Colaço 2017-09-03 15:18:48 +05:30 committed by Alex Beregszaszi
parent bf294253bb
commit 2b88eeb370

View File

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