![]() | The Visual C++ Programming Tutorials: The Value vs. Reference Types
|
|
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.
|
Best viewed using FireFox, Chrome etc. Worst viewed using IE of any version
Webmaster contact: [contact][@][visualcplusdotnet.com] Copyright 2019 © 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 | |
|
|