Skip to content

Instantly share code, notes, and snippets.

@binki
Created October 27, 2017 18:27
Show Gist options
  • Save binki/08b89e0cbde757b3cbdaac8745f7ec77 to your computer and use it in GitHub Desktop.
Save binki/08b89e0cbde757b3cbdaac8745f7ec77 to your computer and use it in GitHub Desktop.
interface IParent
{
void DoParentThings();
}
interface IChild : IParent
{
void DoChildThings();
}
class Child : object, IChild
{
protected Child() : base() { }
public void DoParentThings()
{ }
void IChild.DoChildThings() {
Console.WriteLine($"Child.DoChildThings()");
}
}
class ChildChild : Child, IChild
{
void SomeMethod()
{
IChild child = this;
child.DoChildThings(); // "ChildChild.DoChildThings()"
// No way to call base.DoChildThings() here.
}
void IChild.DoChildThings()
{
Console.WriteLine($"ChildChild.DoChildThings()");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment