Blog/Explicitimplicit-interface-implementation-in-C

 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
--- Blog/Explicitimplicit-interface-implementation-in-C rto 2009-02-02 09:28:15.120480 

+++ Blog/Explicitimplicit-interface-implementation-in-C rto 2008-07-06 20:40:51 

@@ -2,7 +2,7 @@


 Consider the following code:

-    #!csharp
+    #!java
        public interface ITest
        {
           void DoStuff();
@@ -22,7 +22,7 @@


 Where it gets really cool is when you consider what happens if a method is removed from the interface, this shows up as a compilation error when we use explicit interface implementations, where as with implicit interface implementations the method can linger around in a class for a long time, before it is noticed as implementing a method of a previous interface revision.

-    #!csharp
+    #!java
        public interface ITest
        {
        }
@@ -41,7 +41,7 @@


 But, and this is a big but, when you start using a class which implements an interface explicitly you are left with one big thorn in your eye, you would think that writing something like the following should be possible:

-    #!csharp
+    #!java
        class Program
        {
           static void Main( string[] args )