Skip to content

Instantly share code, notes, and snippets.

@robmcl4
Created August 10, 2017 18:26
Show Gist options
  • Save robmcl4/af46a0e234ce41dcdb845c9e7c39f2b0 to your computer and use it in GitHub Desktop.
Save robmcl4/af46a0e234ce41dcdb845c9e7c39f2b0 to your computer and use it in GitHub Desktop.
whateven
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