Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Comparing objects
Message
De
07/08/1998 16:11:45
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
07/08/1998 15:47:53
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00124254
Message ID:
00124939
Vues:
23
>>>Don't we have a function called CompObj()? And the Tamar's hackers' guide has some tips and tracks when using this functions.
>>>
>>>Chris Lee
>>
>>Chris,
>>
>>yes ther is afunction named CompObj() but it does tell if the two object reference point to the same object. It only tells you that all of the property values or the two object have the same values. That could cause a problem by saying that two objects are the same when in fact they aren't.
>>
>>Thats is why my suggestion first comapre the names of teh two object adn then the names of each one's parent object. If they have the same name and they in the same container then they must be the same object. VFP would bark up a storm if we tried to put two object with the same name in the same container.
>
>Well, this makes CompObj() usable in this case - name is also a property, so it should be sufficient. While we're at it, is there any other way to make two objects comparable via CompObj() except Scatter ...Name? No, even that wouldn't make them the same, because they'd have different names. No, just tried it - they don't have names :). I've even tried to CreateObject() two objects, and they, of course, got different names. If they even had same names, they'd have to belong to different containers, so their .Parent would be different.
>
>So, let's rephrase the question: is there any other possibility of CompObj() returning .t., except
> Scatter Name - twice the same record to different objects
> obj1=obj2 - which makes them actually two references to the same memory block containing one object.

Yes, there is another.
o1 = createobject("Form")
o2 = createobject("Form")
o1.name = o2.name
o1.caption = o2.caption
compobj(o1,o2) returns .t.
For that reason compobj() by itself is not adequate.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform