Revised: Thu May 05 15:30:44 CDT 2016
This page is part of a Book titled XNA Game Studio .
Table of Contents
- Table of Contents
- Preface
-
General
background information
- What is polymorphism?
- How does C# implement polymorphism?
- The class named Object
- Multiple methods with the same name
- Compile-time and runtime polymorphism, what's the difference?
- Every class extends some other class
- A class hierarchy
- Methods in the Object class
- Three distinct forms of polymorphism
- Method overloading
- Preview
- Discussion and sample code
- Run the program
- Run my program
- Summary
- Miscellaneous
- Complete program listing
Preface
This module is one in a collection of modules designed primarily for teaching GAME 1343 Game and Simulation Programming I at Austin Community College in Austin, TX. These modules are intended tosupplement and not to replace the textbook.
An earlier module titled Getting Started provided information on how to get started programming with Microsoft's XNA Game Studio.
The three main characteristics of an object-oriented program
Object-oriented programs exhibit three main characteristics:
- Encapsulation
- Inheritance
- Polymorphism
I have explained encapsulation and inheritance in previous modules. I will begin the explanation of polymorphism in this module. However, polymorphism is acomplex topic and several modules will be required to complete the explanation.
Viewing tip
I recommend that you open another copy of this module in a separate browser window and use the following links to easily find and view the Figuresand Listings while you are reading about them.
Figures
- Figure 1 . Screen output from the project named Polymorph01.
Listings
- Listing 1 . Class A from the project named Polymorph01.
- Listing 2 . Class B from the project named Polymorph01.
- Listing 3 . Class Polymorph01 from the project named Polymorph01.
- Listing 4 . Project Polymorph01.
General background information
What is polymorphism?
The meaning of the word polymorphism is something like one name, many forms .