© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
A. Troelsen, P. JapiksePro C# 10 with .NET 6https://doi.org/10.1007/978-1-4842-7869-7_6

6. Understanding Inheritance and Polymorphism

Andrew Troelsen1   and Phil Japikse2
(1)
Chambersburg, PA, USA
(2)
West Chester, OH, USA
 

Chapter 5 examined the first pillar of OOP: encapsulation. At that time, you learned how to build a single well-defined class type with constructors and various members (fields, properties, methods, constants, and read-only fields). This chapter will focus on the remaining two pillars of OOP: inheritance and polymorphism.

First, you will learn how to build families of related classes using inheritance. As you will see, this form of code reuse ...

Get Pro C# 10 with .NET 6: Foundational Principles and Practices in Programming 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.