For a contract to be able to create another contract, it needs the bytecode of the contract that is to be created. When a product creates a new product, that new product has to have the byte code of product as well and so on. The bytecode of products would be infinitly large.
You could create a factory contract, which contains the logic for creating new contracts, like this:
pragma solidity ^0.4.22;
contract Factory{
function createNewProduct(Product _reference) public returns (Product) {
Product p = new Product(_reference, this);
return p;
}
}
contract Product {
Factory public factory;
Product public reference;
function Product(Product _reference, Factory _factory){
reference = _reference;
factory = _factory;
}
function haveFactoryCreateProductWithReferenceToThis() public {
emit ProductCreated(factory.createNewProduct(this));
}
event ProductCreated(Product indexed product);
}
To deploy, first create the factory, then create a product (X) with reference "0x0". After that, you can create new products using the function haveFactoryCreateProductWithReferenceToThis