Casting from parent class to child class

In reply to manik16:

Your code is not difficult to read, but you are doing strange and confusing things. An example

child child_obj_2 = new;  // constructing an object child_obj_2
child child_obj_1; 
base_obj_1  = new;        // constructing an object  base_obj_1
base_obj_1 = child_obj_2; // overrirding your base_obj_1 with child_obj_2

You have now 2 refernces to 1 object. Is this really your intention?