O'Reilly logo

Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition by Harvey M. Deitel - Deitel & Associates, Inc., Paul J. Deitel - Deitel & Associates, Inc.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.13. Passing Arguments: Pass-by-Value vs. Pass-by-Reference

Arguments are passed in one of two ways: pass-by-value and pass-by-reference. When an argument is passed by value, the program makes a copy of the argument’s value and passes the copy to the called method. With pass-by-value, changes to the called method’s copy do not affect the original variable’s value in the caller. In contrast, when an argument is passed by reference, the caller gives the called method the ability to access and modify the caller’s original data directly. Fig. 7.10 demonstrates passing value-type arguments by value and by reference.

Figure 7.10. ByVal and ByRef used to pass value-type arguments.
					1
					' Fig. 7.10: ByRefTest.vb
					2
					' Demonstrates passing by value and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required