Created
August 10, 2017 18:26
-
-
Save robmcl4/af46a0e234ce41dcdb845c9e7c39f2b0 to your computer and use it in GitHub Desktop.
whateven
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
public static void Main() | |
{ | |
var dog = new Dog(100.0, 200.0); | |
double weight = (GetWeight) dog; | |
} | |
public class Dog | |
{ | |
double weight; | |
double height; | |
public Dog( double weight, double height ) | |
{ | |
this.weight = weight; | |
this.height = height; | |
} | |
public static implicit operator GetWeight(Dog d) | |
{ | |
return new GetWeight(d.weight); | |
} | |
} | |
public class GetWeight | |
{ | |
double weight; | |
public GetWeight( double weight ) | |
{ | |
this.weight = weight; | |
} | |
public static implicit operator double( GetWeight g ) | |
{ | |
return g.weight; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment