Creating Class Hierarchies

In Chapter 6, you learned how to create classes, add attributes and methods, and instantiate object instances of the classes in client code. This chapter introduces the concepts of inheritance and polymorphism.

Inheritance is one of the most powerful and fundamental features of any OOP language. Using inheritance, you create base classes that encapsulate common functionality. Other classes can be derived from these base classes. The derived classes inherit the properties and methods of the base classes and extend the functionality as needed.

A second fundamental OOP feature is polymorphism. Polymorphism ...

Get Beginning C# Object-Oriented Programming, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.