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

0.7 Xna0112-type conversion, casting, and assignment compatibility

Learn about assignment compatibility, type conversion, and casting for both primitive and reference types. Also learn about the relationships among reference types, method invocations, and the location in the class hierarchy where a method is defined.

Revised: Fri May 06 14:33:08 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.

Object-oriented programs exhibit three main characteristics:

  • Encapsulation
  • Inheritance
  • Polymorphism

I have explained encapsulation, inheritance, and compile-time polymorphism in earlier modules. Before I can explain runtime polymorphism, however, I need tostep back and explain some concepts involving type conversion, casting, and assignment compatibility.

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 Listings while you are reading about them.

Listings

General background information

Type conversion

This module explains type conversion for both primitive and reference types.

Assignment compatibility

A value of a particular type may be assignment-compatible with a variable of another type. If so, the value can be assigned directly to the variable.

<< 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.