Creating contracts using the new operator
A contract can create a new contract using the new keyword. The complete code of the contract being created has to be known.
Here is an example to demonstrate this:
contract sample1
{
int a;
function assign(int b)
{
a = b;
}
}
contract sample2{
function sample2()
{
sample1 s = new sample1();
s.assign(12);
}
}