Chapter 14. Interfaces
In the previous chapter, we discussed inheritance as a way of abstracting common attributes of types into base types. Inheritance is a good way of expressing the essential nature of a type; for example, an Employee
is a Person
and a Manager
is an Employee
. But because types can only have a single base class, inheritance cannot be used to express general capabilities of types. For example, many types are “comparable,” which is the property of having values that can be “less than” or “greater than” other values. (For example, both numbers and dates are comparable types.) Comparable types have many useful attributes, not the least of which is that they can be sorted into an order.
However, inheritance is usually not sufficient ...
Get Visual Basic .NET Programming Language, The 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.