What’s In This Chapter?
Wrox.com Code Downloads for This Chapter
The wrox.com code downloads for this chapter are found at www.wrox.com/go/professionalcsharp6 on the Download Code tab. The code for this chapter is divided into the following major examples:
The three most important concepts of object-orientation are inheritance, encapsulation, and polymorphism. Chapter 3, “Objects and Types,” talks about creating individual classes to arrange properties, methods, and fields. When members of a type are declared private, they cannot be accessed from the outside. They are encapsulated within the type. This chapter’s focus is on inheritance and polymorphism.
The previous chapter explains that all classes ultimately derive from the class System.Object. This chapter covers how to create a hierarchy of classes and how polymorphism works with C#. It also describes all the C# keywords related to inheritance.
Let’s start by reviewing some object-oriented (OO) terms and look at what C# does and does not support as far as inheritance is concerned.