Visual C++ .NET is smiling to you, please return her smile  

Visual C++ .Net Programming Tutorials: The Value vs. Reference Types

 

Home

 

 

 

 

 

 

Many data types within .NET are represented by classes that are referred as a reference type. However, not every data type in .NET is a class, and now you’re going to meet the other fundamental building block of .NET types, the value type. In this module, you’ll discover what value types are and how they differ from the reference types you’ve already learned. You will also meet two important value types, structures and enumerations. Classes are known as reference types because you always access objects by using reference variables.

As the name value type implies, they have been designed to hold values, such as integers, floating-point numbers, Booleans, and characters. Anything that is basically a wrapper around a simple value and is less than about 16 bytes in size, is a good candidate for a value type. We need value types because we want simple values to be used as efficiently as possible, but we also want them to be usable as objects. Using values as objects is a problem with object-oriented languages (such as traditional C++) because if basic types are represented as objects, all operations (such as addition and multiplication of integers) have to be done by calling functions, which isn’t efficient at all. On the other hand, if basic types are not represented as objects, operations on them can be very efficient but we can’t use them where objects are needed. Well, you can start browsing and learning the following topics.

  1. C++ .NET Value Type 1: Reference Types and Value Types, The Need for Value Types, Properties of Value Types, Structures and Creating and Using a Simple Struct

  2. C++ .NET Value Type 2: Debugging the Structure, Differences Between Structures and Classes and Implementing Constructors for a Struct

  3. C++ .NET Value Type 3: Using One Struct Inside Another: Nested Structure and Copying Structs

  4. C++ .NET Value Type 4: Enumerations, Creating and Using an Enum, Using Enums in Programs, Another Example, Avoiding Ambiguity, Using Memory Efficiently and Quick Reference

 

 

 

Best viewed using FireFox 1.5.0 and above. Worst viewed using IE of any version

 

Webmaster contact: [contact[@]visualcplusdotnet.com]

Copyright 2009 © Visualcplusdotnet. All rights reserved.

Excellent hosting services provided by MochaHost - The Online Central

 

| About | Disclaimer | Privacy | Site Index & Project Download | Native C | Contact |

 
 

 

Custom Search