R
Robin Tucker
Although I've been working on this project for 8 months now, I'm still not
sure of the difference between ByVal and ByRef. As most objects in VB are
reference types, passing ByVal I've discovered allows me to store a
reference to the object I passed by val, to change that object and for the
change to be reflected in the callers copy of the reference (confused?).
Well, what is byref for in that case?
I'm coming from a C++ background here, where a reference is a pointer
(kind-of), a pointer is a pointer and passing an object by value dumps a
copy of the thing on the stack. I don't think things work like this in VB.
ByVal is not the same as C++ passing by value.
Can someone clear up my confusion and tell me where (apart from in COM
wrappers) I really need to use byref?
Thanks
Robin
sure of the difference between ByVal and ByRef. As most objects in VB are
reference types, passing ByVal I've discovered allows me to store a
reference to the object I passed by val, to change that object and for the
change to be reflected in the callers copy of the reference (confused?).
Well, what is byref for in that case?
I'm coming from a C++ background here, where a reference is a pointer
(kind-of), a pointer is a pointer and passing an object by value dumps a
copy of the thing on the stack. I don't think things work like this in VB.
ByVal is not the same as C++ passing by value.
Can someone clear up my confusion and tell me where (apart from in COM
wrappers) I really need to use byref?
Thanks
Robin