mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2870 from aarongoa/develop
Add payable constructor for `C` - #2869
This commit is contained in:
commit
fabf4accd3
@ -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
|
||||
==================================
|
||||
|
Loading…
Reference in New Issue
Block a user