This page is optimized for mobile devices, if you would prefer the desktop version just click here

0.6 Xna0110-polymorphism based on overloaded methods

Learn that overloaded methods have the same name and different formal argument lists; that the word polymorphism means something like one name, many forms; that polymorphism manifests itself in C# in the form of multiple methods having the same name; that polymorphism manifests itself in three distinct forms in C#: method overloading, method overriding through class inheritance, and method overriding through interface inheritance.

Revised: Thu May 05 15:30:44 CDT 2016

This page is part of a Book titled XNA Game Studio .

Table of Contents

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 .

<< Chapter < Page Page > Chapter >>

Read also:

OpenStax, Xna game studio. OpenStax CNX. Feb 28, 2014 Download for free at https://legacy.cnx.org/content/col11634/1.6
Google Play and the Google Play logo are trademarks of Google Inc.
Jobilize.com uses cookies to ensure that you get the best experience. By continuing to use Jobilize.com web-site, you agree to the Terms of Use and Privacy Policy.