|
-
September 7th, 2011, 10:30 PM
#16
Re: Modify Object by reference
mmmmmmm..... I think some thing was over looked here....
There is a difference in class fields, vs class properties...
Class fields:
Code:
Public Class Test
Public SomeName as String
Public Age as Integer
End Class
Are treated as value types....
While a property:
Code:
Public Class Test
Public Property SomeName as String
Public Property Age as Integer
End Class
(yes, I realized I use the VB10 syntax there, sue me, point still applies)
Get treated as reference types and are part of the object.
The difference in this distinction causes the rules to change when they are passed around. And has a lot to do with where they get stored (heap vs stack).
Gremlins - I don't buy that (at least no with out references (no pun intended)) ... granted it's been sometime since i've been out of th VB6 game... but if memory serves (and it could be faulty, I will grant that) ... that's NOT the experience I remember and I did a LOT of work with system that was heavy on the DLLs.
WOF - you SHOULD be able to pass an object's property by ref to be modified... but it has to be a PROPERTY... not a field... they are not interchangeable... in your first post, you show them as fields... not properties.
-tg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|