Salesforce 'typeOf' usage for multi-reference fields

Publisher:

Description
This recipe shows how to use the 'typeOf' SOQL statement in Salesforce. TYPEOF is an optional clause that can be used in a SELECT statement of a SOQL query when you’re querying data that contains polymorphic relationships. A TYPEOF expression specifies a set of fields to select that depend on the runtime type of the polymorphic reference.