This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
If you compile your code with these lines your code will run fine at runtime.
In your case new parent() object has the no knowledge of child class that's why at run time it just broke down. (cast) operator is used for asking compiler to skip checking the compatibilty of the the two operands on either side of = operator, that is why it was fine at compile time.