blob: fbef3ced10b28139d88cb82e6094adba25554b15 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
using System;
namespace Martin {
public struct A
{
public readonly long Data;
public A (long data)
{
this.Data = data;
}
public static explicit operator B (A a)
{
return new B ((int) a.Data);
}
}
public struct B
{
public readonly int Data;
public B (int data)
{
this.Data = data;
}
public static implicit operator A (B b)
{
return new A (b.Data);
}
}
class X
{
static void Main ()
{
B? b = new B (5);
A? a = b;
B? c = (B?) a;
B? d = (Martin.B?) a;
}
}
}
|