Monday, November 22, 2010

CTS Interface Types

Interfaces are nothing more than a named collection of abstract member definitions, which may be
supported (i.e., implemented) by a given class or structure. In C#, interface types are defined using the
interface keyword. By convention, all .NET interfaces begin with a capital letter I, as in the following
example:
// A C# interface type is usually
// declared as public, to allow types in other
// assemblies to implement their behavior.
public interface IDraw
{
void Draw();
}
On their own, interfaces are of little use. However, when a class or structure implements a given
interface in its unique way, you are able to request access to the supplied functionality using an interface
reference in a polymorphic manner.

No comments:

Post a Comment