How to call child class function having only parent class object

In reply to haykp:

You need to provide a more complete example, and show us the error you are getting. You also should be testing the return value of $cast.