Interfaces and Polymorphism

Chapter 12, “Inheritance,” discusses polymorphism with a basic purpose to offer a common infrastructure to different kinds of objects. In the discussion, interfaces find their natural habitat. They provide a common set of members that classes need to implement if they need to perform a particular series of tasks. A typical example is the IDisposable interface that you met in Chapter 8. All classes that need to provide a mechanism for releasing resources implement that interface, which exposes a set of common members. Another example is the ICloneable interface that defines a Clone method that classes can implement to provide the ability to copy a class instance. You can easily understand that interfaces are generic; ...

Get Visual Basic® 2010 Unleashed 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.