[Mono-list] implicit, explicit, and why does C# have these?

Arild Fines arild.fines@broadpark.no
Fri, 17 Oct 2003 16:09:46 +0200


David La Motta wrote:
> I guess I should expand on my [sort-of] gripe.  Implicit casting by
> the language itself is OK where it makes sense, like in your example
> of int and long.  But, logically, it can be confusing to use an
> implicit operator to convert between objects that have nothing in
> common, and never will (like Truck and Pear, for instance).

That's why you don't use the implicit operator to convert between those
objects :-) That's what 'explicit' is for.


--
Arild

AnkhSVN: http://ankhsvn.tigris.org
Blog: http://ankhsvn.com/blog
RSS: http://ankhsvn.com/blog/Rss.aspx

King Crimson lives in different bodies at different times and the
particular form which the group takes changes. When music appears,
which only King Crimson can play then, sooner or later, King Crimson
appears to play the music