Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Pemstatus???
Message
 
 
À
30/10/2004 08:46:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Titre:
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
00956066
Message ID:
00956104
Vues:
9
Martin is right, though -- there are lots of situations in which TYPE() is still actually a lot better.

Consider this:

LPARAMETERS vRef

... now I want to know if vRef has the PEM. It's possible that a non-object was passed, or an object of an incorrect class was passed.

It's also possible that the member is an object of known type but I have to make sure that the object has a given custom property. Perhaps it has the property but the property is hidden or protected by a subclass, so I can't use it:
   IF TYPE("vRef."+cMyRequiredProperty) # "U" 
      * or check for specific type, or drill down
      * to determine whether the member is of correct
      * class, such as:
      * TYPE("vRef.MyRequiredObjMember.BaseClass") = "C" AND ;
      *   UPPER(vRef.MyRequiredObjMember.BaseClass) = "WHATEVER"
      * or
      * TYPE("vRef."+cMyRequiredObjMember+ "." + cMemberProperty) # "U" 
Or consider that vRef may be a string which represents the *name* of a variable, where the actual variable name is unknown. So now I can say:

IF TYPE(vRef+"."+cMyRequiredProperty) && etc, as above

... yeah, we've gotten a lot of great, newer functions to use over the years... but sometimes it's darned useful <s>. It will work in a lot of difficult places as a single test, without a TRY CATCH, without failing.

>L<
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform