Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How am I supposed to do this?
Message
De
12/11/1998 11:24:08
 
 
À
12/11/1998 08:35:13
Calvin Smith
Wayne Reaves Computer Systems
Macon, Georgie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00156920
Message ID:
00156992
Vues:
22
>I have a customer table made up of customers of at least 2 different types. I create three classes: BaseCust, Cust1, and Cust2. For the sake of illustration the method FigureAmtDue is completely different for Cust1 and Cust2. I understand how this works in plain jane code: Create an instance of whichever class you are working with and call the method. However, how is this done on a report where I am trying to figure the total amount due for all customers? Do I create an instance of the class on the record break and subsequently destroy it only to call it again? I must be missing something in my understanding of Classes or is this the way it is actually done? I guess the same thing would apply on a grid if there is a calculated field. Someone please help me before I completely screw up a project. Thanks :)

What I think you are asking is two different questions:
1. How do I model my data to reflect 2 different types of customers?
2. how do I model my classes to reflect two different types of customers?

Data should be simple. 1 customer table with field that denotes if the customer is of type A or type B. When building forms or routines that deal with only TYPE A customers, filter out the TYPE B ones (p-view, or whatever). When building routines that deal with both, ignore the field.

When building classes or business objects to deal with this scenario, you need a customer class to hold all functionality that is common to all customers, regardless of their "A"ness or "B"ness. Then subclass this class twice: once for type A customers and once for type B customers. Now in each subclass you have all the functionality that is specific to that type of customer, and also all the functionality that all customers need.

Did I even come close to answering your question?
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform