CHAPTER 13

Creating interfaces and defining abstract classes

After completing this chapter, you will be able to:

  • Define an interface specifying the signatures and return types of methods.

  • Implement an interface in a structure or class.

  • Reference a class through an interface.

  • Capture common implementation details in an abstract class.

  • Implement sealed classes that cannot be used to derive new classes.

Inheriting from a class is a powerful mechanism, but the real power of inheritance comes from inheriting from an interface. An interface does not contain any code or data; it just specifies the methods and properties that a class that inherits from the interface must provide. By using an interface, you can completely separate the names and signatures ...

Get Microsoft Visual C# Step by Step, Ninth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.