Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Naming conventions for custom methods?
Message
De
18/11/2008 17:25:35
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
18/11/2008 13:40:03
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
01362229
Message ID:
01362687
Vues:
24
>I must be missing something in the messages. I'm late to the game :o) I didn't read them all. You can just pass the object and .net will prompt you with intellisense what parameter types are acceptable. If you pass the object, you can simply write the equivalent to a case statement (switch) to do whatever you need to do based on the type of object passed. That much is like VFP except that when you write the code to pass the object, .net will tell you if it is of the type to be accepted or not and what overloaded methods exist. You can pass and receive an object and then do whatever you wish based on the type of object passed. I have seen many times in code the passing of 'this' for that scenario. You check for the 'type of' object passed in the called method just like in VFP we check for baseclass type or something like that.

That's it, in a nutshell (or outside of it, if we crack it). The code below was just an example of what I routinely do, prompted by Mike's dislike for passing objects as parameters. The answer to the unspoken question "why the {negative religious reference} would you want to do that?".

>>>>Just imagine a simple decorator pattern, which would recurse through all the objects on a form, and, say, apply local codepage if so configured. It would have to check anything that has font properties (or .font member - in case it's an ActiveX), and set the codepage to it... like this:
>>>>
>>>>
PROCEDURE Cyrillize(toObj)
>>>>	TRY
>>>>		IF PEMSTATUS(toObj, "fontcharset",5)
>>>>			toObj.FONTCHARSET=204
>>>>		ENDIF
>>>>		IF PEMSTATUS(toobj, "fonts",5)
>>>>			ofn=toobj.fonts
>>>>			ofn.charset=204
>>>>		endif
>>>>	CATCH
>>>>		WAIT SYS(1272,toObj)+0h0d+" just won't go Cyrillic, stubborn mule." WINDOW TIMEOUT 1
>>>>	ENDTRY
>>>>

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform