Execute a method. Help me, please.

Hi all,I齰e three classes: Transaction, Card(Abstract), Credit_Card and Debit_Card. Card is subclass of Transaction and Credit_Card and Debit_Card are subclasses of Card. How do I make to execute a method in the Credit_Card or Debit_Card classes from Transaction class?
[282 byte] By [2481572a] at [2007-9-28 16:27:09]
# 1

Hi,

Card class should not be a subclass of Transaction, because of the simple fact that a card is not a transaction. Try to define a relationship between Transaction and Card. So, a Card know its Transaction objects and a Transaction object knows which Card object it is associated with. Then, inside the Transaction code, you can find Card object reference and invoke on it.

Thanks.

Tommy

MuranoYina at 2007-7-12 13:37:08 > top of Java-index,Other Topics,Patterns & OO Design...