Conclusion
Inheritance is a powerful way of expressing the relationships between types and reusing code across multiple types. The .NET Framework class libraries make extensive use of inheritance, and understanding inheritance is essential to understanding those libraries. Overridable methods and abstract methods provide a way for derived classes to specialize the behavior of their base classes. In the next chapter, we will discuss another way of reusing code across types: interfaces.
Here are some style points to keep in mind.
-
The Object type combines the capabilities that used to be split between the Object type and the Variant type in previous versions of Visual Basic.
-
Unless code is particularly performance sensitive and doing a lot of unboxing, CType is more general than DirectCast and is preferred.