In this chapter, we are going to look at the similarities between the different types of game objects and how we can express these similarities in C#. The main technique used for this is inheritance. Inheritance is a technique that is used to structure related classes in a hierarchy. We will show how to override methods in a subclass to provide specific behavior for that class. We will deal with access modifiers for class members. We will also introduce the concept of polymorphism, which allows calling the right version of a method automatically.
Unable to display preview. Download preview PDF.