What is the difference between casting and conversion? [duplicate]

Casting is a way of telling the compiler “Object X is really Type Y, go ahead and treat it as such.”

Conversion is saying “I know Object X isn’t Type Y, but there exists a way of creating a new Object from X of Type Y, go ahead and do it.”

Leave a Comment