August 2019
Intermediate to advanced
486 pages
13h 52m
English
Solidity contracts also have the capability to create a new child contract of any definition. This is achieved by using the new keyword. Sometimes, depending on your application's design, you will want to create a child contract and get its address registered in the main contract.
One requirement for the new keyword is that, when it is being executed in your main contract, it should know the complete definition of the child contract that it is going to create.
The following is an example MainContract, which behaves as a register for every ChildContract it creates. When MainContract is deployed, it also deploys a ChildContract instance and assigns it to the ChildContract state variable. MainContract ...