Recall: Conversions Among Related Class Types
As shown in Chapter 6, class types may be related by classical inheritance (the “is-a” relationship).
In this case, the C# conversion process allows you to cast up and down the class hierarchy. For
example, a derived class can always be implicitly cast to a base type. However, if you wish to store
a base class type in a derived variable, you must perform an explicit cast:
C H A P T E R 1 2
■
I N D E X E R S, O P E R ATO R S, A N D P O I N T E R S
397
8849CH12.qxd 9/26/07 11:31 AM Page 397
Do'stlaringiz bilan baham: |