-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInterfaceOverloads2.cs
More file actions
38 lines (34 loc) · 831 Bytes
/
Copy pathInterfaceOverloads2.cs
File metadata and controls
38 lines (34 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
public interface IInterface
{
void InterfaceMethod(int x);
void InterfaceMethod(long x);
void InterfaceMethod(string s);
}
public class CustomType1 : IInterface
{
public void InterfaceMethod(int x)
{
Console.WriteLine("CustomType1.InterfaceMethod1({0})", x);
}
public void InterfaceMethod(long x)
{
Console.WriteLine("CustomType1.InterfaceMethod2({0})", x);
}
public void InterfaceMethod (string s)
{
Console.WriteLine("CustomType1.InterfaceMethod3({0})", s);
}
}
public static class Program
{
public static void Main(string[] args)
{
var a = new CustomType1();
a.InterfaceMethod(32);
a.InterfaceMethod("a");
IInterface b = a;
b.InterfaceMethod(32);
b.InterfaceMethod("b");
}
}