4.6. Value Types and Reference Types

Data types in Visual Basic are divided into two categories—value types and reference types. A variable of a value type (such as Integer) simply contains a value of that type. For example, Fig. 4.10 shows an Integer variable named count that contains the value 7.

Figure 4.10. Value type variable.

By contrast, a variable of a reference type (sometimes called a reference) contains the memory address where the data referred to by that variable is stored. Such a variable is said to refer to an object in the program. Line 8 of Fig. 4.8 creates a GradeBook object, places it in memory and stores the object’s memory ...

Get Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.