Skip to content

Instantly share code, notes, and snippets.

@yellis
Created November 15, 2012 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yellis/197e8ed135e1abe5d09a to your computer and use it in GitHub Desktop.
Save yellis/197e8ed135e1abe5d09a to your computer and use it in GitHub Desktop.
Implicit inheritance example (C#)
void Main()
{
var b = new B();
Console.WriteLine(String.Format("B is A: {0}", (b is A)));
Console.WriteLine(String.Format("B is ISoftDelete: {0}", (b is ISoftDelete)));
}
interface ISoftDelete
{
bool IsDeleted {get; set;}
}
class A {
public int Id {get; set;}
}
partial class B : A {
public bool IsDeleted {get; set;}
}
partial class B : ISoftDelete {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment