O'Reilly logo

Microsoft® Visual C#® 2008 Step by Step by John Sharp

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Interface Restrictions

The essential idea to remember is that an interface never contains any implementation. The following restrictions are natural consequences of this:

  • You're not allowed to define any fields in an interface, not even static ones. A field is an implementation detail of a class or structure.

  • You're not allowed to define any constructors in an interface. A constructor is also considered to be an implementation detail of a class or structure.

  • You're not allowed to define a destructor in an interface. A destructor contains the statements used to destroy an object instance. (Destructors are described in Chapter 14, Chapter 14.)

  • You cannot specify an access modifier for any method. All methods in an interface are implicitly public.

  • You ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required