|
-
Feb 13th, 2001, 09:31 AM
#1
Thread Starter
New Member
How can i compare 2 refernces of One Instance of an Object
Example:
Set objA = CreateObject ("ClassString.Class")
Set objB = ObjA
If ObjB = ObjA Then MsgBox ("OK")
etc...
why does this compare of 2 Instances not work ???
Is there a other way ??
thanks
Stonebrook
-
Feb 13th, 2001, 09:50 AM
#2
Fanatic Member
Well
If there is a property that generates a unique identifier everytime an instance is created then you can compare these.
If not, it could be tricky. Change a property value on one and then see if it changes on the other?
-
Feb 13th, 2001, 03:47 PM
#3
pointers
it doesnt work because you are asking if two pointers
are the value..since A points to the data and B points to A they will not be the same...
i know somebody will say VB doesnt use pointers...
but it actually uses a vtable of addresses and thats
pretty much the same thing..
in "C" it's called indirect reference...
since you are assigning these pointers to objects...
A -> object
B -> A
this would work.. A.Property = cow
B.Property = cow
otherwise A = object address
B = A address
that was easy huh....
-
Feb 14th, 2001, 03:09 AM
#4
Thread Starter
New Member
... next
... what happens with the Refernce of Object B if i free Object A ??
-
Feb 14th, 2001, 03:45 AM
#5
Fanatic Member
Nothing.
Because B is NOT pointing to A. B is pointing to the object. If you remove A, B will still be referencing the same object.
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
|