using System;
public struct ShortWrapper
{
public short value;
public ShortWrapper(short va)
{
this.value = va;
}
public static implicit operator short(ShortWrapper d) => d.value;
public static implicit operator ShortWrapper(short d) => new ShortWrapper(d);
}
public class Program
{
public static void Main(string[] args)
{
ShortWrapper w = 1;
int tw = 20;
int value = tw - w; // error no operator
test(tw, w); // ShortWrapper can't not be cast to int
Console.WriteLine(w);
}
private static void test(int b, int a)
{
}
}
two error in consulo, but compiled