Skip to content

Instantly share code, notes, and snippets.

@cgatian
Last active December 20, 2015 20:49
Show Gist options
  • Save cgatian/6193575 to your computer and use it in GitHub Desktop.
Save cgatian/6193575 to your computer and use it in GitHub Desktop.
public class Base
{
public long _id;
public Base(long id)
{
this._id = id;
}
}
public class A : Base
{
public A(long id) : base(id)
{
}
}
public class B : Base
{
public B(long id) : base(id)
{
}
public static implicit operator A(B id)
{
return new A(id._id);
}
}
class Program
{
static void Main(string[] args)
{
B _b = new B(10);
A _a = _b;
Base _base = _a;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment