Hi Chad,
You might want to re-read my post. It might just be me but your responses
don't seem to make much sense in the context they are in. But just to
clarify a couple of things:
...when you do not have access to alter base classes, its very important in
providing conversions...
It's actually only one of (and in my opinion the least preferable) method of
doing conversions. Explicit conversion operators, conversion functions and
conversion constructors are all superior.
...a true OOP system cannot function without it. Floats, integers, etc are
ALL implemented this way internally to .net...
That a 'true' OOP system requires implicit conversion operators is certainly
highly debatable. Also, your reference to floats, integers, etc. is somewhat
disingenuous, I was explicitly speaking of custom types not primitives and I
added that there are some instances where an implicit conversion operator is
useful for value types.
...They are not limited to value types, and you do not convert the
reference.
I didn't say anything about them being limited to value types. But if you
have an assignment statement (or method parameter) that involves an implicit
conversion operator then unlike the standard for reference types of simply
copying a reference to the original object into the new variable you are
actually creating a new object and then assigning its reference to the
variable (unless of course your conversion operator returned a this
reference but that would be rather unusual). This then makes your reference
types act like value types (copy on assignment), at least an explicit
conversion operator gives you warning (though a conversion function or
conversion constructor would be better).
...It allows one interface to morph onto another.
If you want to convert(morph?) between the interfaces implemented by an
object then the default explicit conversion operator already does that and
there is no reason to make it implicit. If you are creating a new object
that implements a similar interface or has the same base class but
additional interfaces, etc. then you are much better off implementing
conversion constructors or static conversion functions (or if you must an
explicit conversion operator).
Also, again I might be misunderstanding, but your code listing states that
LOutput is of type System.IO.FileStream. In order to pass it to your method
you are casting it to type Borland.Vcl.Classes.TStream. If this is correct
then DirectCast should only work if LOuput is already of type
Borland.Vcl.Classes.TStream, but this isn't the case since it is dimmed and
created the line above as a FileStream and I know that FileStream does not
inherit from Borland.Vcl.Classes.TStream nor does it implement an interface
called Borland.Vcl.Classes.TStream. So, either DirectCast isn't working as
it is supposed to or something is going over my head here.
It's possible we're not understanding each other, talking past each other so
to speak. To clarify what you are talking about perhaps you could post the
code here for your implicit operator and a link to the 'demo' to which you
referred.
<snip>