Data Types I
Data Types I
• Explicit conversions
– Explicit construction from a type provides safe conversion
– Casting offers alternative when safety can only be
determined at run-time (by the program doing the cast)
– Static casts are completed at compile-time
– Dynamic casts check additional information at run-time (e.g.,
if polymorphic) may throw exception, return 0 pointer, etc.