a575963da9
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
58 lines
592 B
C#
58 lines
592 B
C#
class X
|
|
{
|
|
public readonly int value;
|
|
|
|
public X (int value)
|
|
{
|
|
this.value = value;
|
|
}
|
|
|
|
public static implicit operator X (int y)
|
|
{
|
|
return new X (y);
|
|
}
|
|
}
|
|
|
|
class Y
|
|
{
|
|
public readonly X x;
|
|
|
|
public Y (X x)
|
|
{
|
|
this.x = x;
|
|
}
|
|
|
|
public static implicit operator Y (X x)
|
|
{
|
|
return new Y (x);
|
|
}
|
|
}
|
|
|
|
class Z
|
|
{
|
|
public readonly Y y;
|
|
|
|
public Z (Y y)
|
|
{
|
|
this.y = y;
|
|
}
|
|
|
|
public static implicit operator Z (Y y)
|
|
{
|
|
return new Z (y);
|
|
}
|
|
|
|
public static int Main ()
|
|
{
|
|
int a = 5;
|
|
Y y = (Y) (X) a;
|
|
|
|
//.
|
|
// Compile this:
|
|
//
|
|
|
|
int b = (System.Int32)int.Parse ("1");
|
|
return 0;
|
|
}
|
|
}
|