Exact difference between $cast as a task and function

In reply to paragsathe:

When $cast() is used as a task and the casting fails, SV prints a run-time error.
i.e.

$cast(A,B);

When $cast() is used as a function and if casting fails, it returns value “0” and in the case of successful casting, it returns value “1”.
i.e.

if($cast(A,B)) $display("It's a successful casting");
else $display("casting is failed");