Created
March 30, 2014 15:42
-
-
Save kawa-xxx/9874611 to your computer and use it in GitHub Desktop.
Explicit Interface Implementation
This file contains 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
namespace ConsoleApplication | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var hogeFuga = new HogeFuga(); | |
var hoge = (IHoge) hogeFuga; | |
var fuga = (IFuga) hogeFuga; | |
Console.WriteLine(hoge.Do()); | |
Console.WriteLine(fuga.Do()); | |
} | |
} | |
public class HogeFuga : IHoge, IFuga | |
{ | |
string IHoge.Do() | |
{ | |
return "HogeDo!"; | |
} | |
string IFuga.Do() | |
{ | |
return "FugaDo!"; | |
} | |
} | |
interface IHoge | |
{ | |
string Do(); | |
} | |
interface IFuga | |
{ | |
string Do(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment