Created
October 27, 2017 18:27
-
-
Save binki/08b89e0cbde757b3cbdaac8745f7ec77 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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