8.14. Passing Arrays: ByVal vs. ByRef
A variable that “stores” an object, such as an array, does not actually store the object itself. Instead, the variable stores a reference to the object (i.e., the address of the location in the computer’s memory where the object is stored). Recall that in Chapters 4–6, we discussed two types of variables—value types and reference types. The distinction between value-type variables and reference-type variables raises some subtle issues that you must understand to create secure, stable programs.
Effects of ByVal on Value-Type Parameters and Reference-Type Parameters
When used to declare a value-type parameter, keyword ByVal causes the value of the argument to be copied to a local variable in the method. Changes ...
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.