How to create a child block programmatically?

Solution 1:

I solved the problem by using setChild method as follows:

$block->setChild('somealias',$childBlock);

And so I can use

<?php echo $this->getChildHtml('somealias'); ?>