Created
September 5, 2023 13:36
-
-
Save jskeet/2c61ce7f33056f643fe92df19ab25db2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
class Value | |
{ | |
private readonly int x; | |
public Value(int x) | |
{ | |
this.x = x; | |
} | |
public static implicit operator int(Value value) => value.x; | |
} | |
class Test | |
{ | |
static void Main() | |
{ | |
int a = 10; | |
Value b = new Value(20); | |
Console.WriteLine(a + b); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment