Versions des environnements
Network:
Windows 2003 Server
Naomi,
>I have two separate form classes. I added two custom methods to one form class. I found that I need these methods (with descriptions) in another form's class as well.
>How can I copy these two methods form one form to another?
while the PEM-Editor capabilities are really great, use them only to move method to a common parent.
In this case this seems to be impossible, which can happen in single-inheritance languages like vfp.
Copying is IMHO ***the*** most telling mark of a programmer either unwilling or too overworked to think straight.
Granted that you may encounter a bad situation in existing object hierarchies,
but with a few extra strokes you can factor the method out into a special object
you can add to each form - for form methods the best approach, as any "this" references in the org method
can be changed to "thisform" while testing a s a form method and will work identically on a sub-object.
For methods living originally on other objects you can use a "dirtycall"-object on your app object,
to which you move the method code and prefix the parameter list with toThis and toThisForm -
within 5 minutes you have a better (while certainly not perfect) solution.
DRY code is the target of the lazy programmer proud of his virtue!
As you usually opt for better code, don't even think to ask for help in accomplising a *real* copy ;-)
regards
thomas
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement