View Single Post
Old Jul 10th, 2008, 11:10 AM   #4
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 769
Rep Power: 3 Jimbo is on a distinguished road
Re: Visual Basic pointers

I'm not entirely sure how the language is implemented, but I think it works similarly to C#'s ref keyword. If you have Sub Foo(ByVal bar as SomeType) you can modify the contents of the SomeType object locally scoped as bar; since it's the same object as the calling function, these changes would go back. If you make bar point to a new object, then the corresponding variable in the caller will not be affected. If, on the other hand, you have Sub Foo2(ByRef bar2 as SomeType) then any changes to what object bar2 points at or its contents will affect the caller's variable as well.

<reiteration of disclaimer>I'm not positive that this is how it works, and I'm too lazy to write an app to check, but that's how I'd guess it works</reiteration>
__________________
<insert disclaimer here>
<insert shameless plug for Visual Studio here>

Last edited by Jimbo; Jul 10th, 2008 at 11:37 AM.
Jimbo is offline   Reply With Quote