/*
A Programmer's Introduction to C# (Second Edition)
by Eric Gunnerson
Publisher: Apress L.P.
ISBN: 1-893115-62-3
*/
// 24 - User-Defined Conversions\How It Works\Conversion Lookup
// copyright 2000 Eric Gunnerson
public class ConversionLookup
{
public static void Main()
{
S myS = new S();
TBase tb = (TBase) myS;
}
}
public class S
{
public static implicit operator T(S s)
{
// conversion here
return(new T());
}
}
public class TBase
{
}
public class T: TBase
{
}
|