Information générale
Catégorie:
Programmation Orientée Object
>However, in my POS/Invoice module, program will not know the item type key-in/scanned at least search from database. Since, I have multiple of Item class (each for each type of item), how to know which class should be initiated for SKU/Barcode lookup? Should I create one more class just for lookup, then create a appropriate object??
I'd create a "lookup" class, and then have that class instantiate the appropriate "item" class.
I have something similar in my Inventory module which has many different types of "documents"; eg. Purchase Order, Order Receipt, Stock Issue, Return to Stock, Return to Vendor, Inventory Count, Inventory Adjustment, etc.
There is a Document "front-end" that allows a User to retrieve one or more Documents (current or archived) and perform some action (Validate, Validate and Post, Post, Print). This front-end instantiates the appropriate "document object" (which is a subclass of a "document processor" class) based on document type, sets some properties, and then lets the document object execute.
Précédent
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