Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFPConversion Seminar - May 9-10 - Dallas, TX
Message
 
À
14/04/2005 10:35:01
Walter Meester
HoogkarspelPays-Bas
Information générale
Forum:
Visual FoxPro
Catégorie:
Conférences & événements
Divers
Thread ID:
01002513
Message ID:
01004669
Vues:
43
Hi Walter and Martin
This is a great discussion. I just wanted to add a couple of items.

In .NET all objects inherit from the object class so it is possible to pass objects to a function in a generic way. It's basically the job of the function to deal with that object as it sees fit.

I like the example walter used where he recurses a form hierarchy testing for the data type of the object and partying on that object correctly. You can do this in .NET as well

The syntax is similar as well....

Basically it's like this

Function MyFunction(oObject as object)

If TypeOf oObject is Form
'-- party on the form object
ElseIf TypeOf oObject is Button
'-- party on the button object
Else.....
and so-on

You can also add Interfaces to your objects and test for the existance of that interface.
Example

If TypeOf oObject is IRodBinding
Ctype(oObject,IRodBinding).BindingFunction
Else......

I like the .NET way of doing this. It's different than in VFP. Like where we use the Type() function to determine whether an object supports a particular property or method...


Thanks
Rodman
Rod Paddock
Editor in Chief CoDe Magazine
President Dash Point Software, Inc.
VP Red Matrix Technologies,Inc.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform