Upcasting and Downcasting using $cast

Hi,

Can anyone provide an example of upcasting and downcasting using $CAST.

In reply to kmishra:

Upcasting is always OK, but for downcast you have to make a typecast using $cast. See the syntax here:
function int $cast( singular dest_var, singular source_exp );
or
task $cast( singular dest_var, singular source_exp );