Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where to put code for calculated properties?
Message
De
31/01/2001 18:15:25
 
 
À
31/01/2001 17:33:11
Mike Mattos
Nationwide Computers
Mississauga, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00470214
Message ID:
00471003
Vues:
38
>My problem is that the calculation isn't obviously part of THIS.
>

It would be if you had a Sale object. To calculate tax from your different forms you might do:

oSale = CREATEOBJECT("Sale")
oSale.SalesTax = .065
oSale.TaxCode = "abc123"
oSale.State = "TX"
lnTax = oSale.CalculateTax()

or

oSale = CREATEOBJECT("Sale")
oSale.CalculateTax(lnSalesTax, lcState, lcTaxCode)


>I don't want to maintain 3 methods, so I currently add a .prg to the project.

See above.

>I think you are saying to create an object holding sales_tax() and other methods, but that seems a lot more work than just adding the .prg to the project!

I am saying that you create an object that holds related functions, not a collection of every function in your project.

>( ASIDE I use ExamDiff & FileFind to scan my .prg's , I haven't figured a way to do the same with embedded methods )

There are several tools available to do this. My SearchString is one of them. You can get it in the files section.

>this.my_library.sales_tax() instead of SET PROC to my_library is better, I agree, but does it bloat the .exe ?

First of all, you don't have a My_library object. You have different objects that each contain their own relevant methods. Secondly, there is no significant difference between the size of exe using procs and objects, especially if your object are defined in code.
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform