Thursday, January 05, 2006

MF Bliki: ImplicitInterfaceImplementation

Both Java and C# share the same model of pure interface types. You declare a pure interface by going interface Mailable, then you can declare you implement it with class Customer implements Mailable (in Java). A class may implement any number of pure interfaces.

One of the things this model ignores is that you have implicit interfaces whenever you have a class. The implicit interface Customer is all the public members declared on Customer. One thing that neither Java nor C# allow you to do is to implement an implicit interface - you cannot write class ValuedCustomer implements Customer.