A
arthernan
Say I pass an object ByRef. And I want to store a reference to that
object. How do I do this?
Arturo Hernandez
object. How do I do this?
Arturo Hernandez
I am not sure if I understand your answer, however I assume that you want toSay I pass an object ByRef. And I want to store a reference to that
object. How do I do this?
Say I pass an object ByRef. And I want to store a reference to that
object. How do I do this?
Herfried K. Wagner said:There are two kinds of types in .NET: Reference types and value types.
Objects which are instances of a value type are always copied when being
assigned to another variable whereas assigning a reference to an instance
of a reference type will create a new reference. A more detailed
explanation of what's going on when passing objects to a method can be
found here:
Mr Newbie said:Dont you mean that Objects which are instances of a value type which are
passed by value are copies of the original object and therefore when
values > are assigned TO them it is to the copy not the original.
Herfried said:There are two kinds of types in .NET: Reference types and value types.
Objects which are instances of a value type are always copied when being
assigned to another variable whereas assigning a reference to an instance of
a reference type will create a new reference. A more detailed explanation
of what's going on when passing objects to a method can be found here:
<URL:http://groups.google.de/group/microsoft.public.dotnet.languages.vb/msg/25064a4fedd36633>
Class HumpaLumpa
Public Sub CoolSub(ByRef pCar As Car)
Me.vCar=pCar
End Sub
.
.
.
Me.vCar.WindowDown=True 'did the original object get changed or
just a copy of it?
This is a second example:
Class HumpaLumpa
Public Sub CoolSub(ByRef pCar As Integer)
Me.vCar=pCar
End Sub
.
.
.
Me.vCar=22 'did the original variable get changed or
just a copy of it?
'pCar''s value and assign it to 'vCar'.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.