-
-
Save dirvo/bd2aa2242da0fd092239e8b117e9f1cb to your computer and use it in GitHub Desktop.
This file contains 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; | |
class CrazyType | |
{ | |
private int _value; | |
public static implicit operator CrazyType(int value) | |
{ | |
return new CrazyType { _value = value }; | |
} | |
public static implicit operator int(CrazyType value) | |
{ | |
return value._value++; | |
} | |
private static void Main(string[] args) | |
{ | |
CrazyType a = 1; | |
if (a == 1 && a == 2 && a == 3) | |
{ | |
Console.WriteLine("YAY!"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment