Results 1 to 1 of 1
- 12-11-2007, 08:55 PM #1Member
- Join Date
- Nov 2007
- Rep Power
which class is superclass and subclass?
I need your opinion regarding the relations between those classes, I don't know which class should be the super class and which one is the subclass ..
in this case the Store class has two menues: the first menu is for Item1 class only addnewItem, changePrice. And the other menu has addnewItem, changePrice too in addition CheckOrders for Item 2 class only.
I use addnewItem to add to Item 1 class and same thing to changePrice method just using the message forwarding idea and passing everything to Item1.
and since Item 2 class inherits addnewItem, changePrice from the Item 1 class then it has another method CheckOrders that Item 1 shouldn't have.. (and because item 2 is a subclass it should have more methods than its parent that's why I put it as a child) but how can I check the items in Item 2 class from Store class??? I can't pass it to Item 1 first because it doesn't use this method "I don't know if there is a way to do it ", should I put Item 2 as a parent and Item 1 as a child??
after editing: they are not different menues they are same methods exactly except checkOrders option displayed when the user choose Item2, I mean that the user choose first does he want to perform operations on Item1 or Item2.. if Item1 then the operations are addnewItem and changePrice, and if the choice was Item2 the operations are the same addnewItem and changePrice methods in addition CheckOrders.
here is the diagram to explain what I want
Last edited by java_fun2007; 12-11-2007 at 09:11 PM. Reason: to add more info
- By bugger in forum New To JavaReplies: 1Last Post: 01-13-2008, 07:31 PM
- By Java Tip in forum Java TipReplies: 0Last Post: 12-06-2007, 02:51 PM
- By ravian in forum New To JavaReplies: 1Last Post: 11-19-2007, 05:54 PM
- By Java Tip in forum Java TipReplies: 0Last Post: 11-12-2007, 11:53 AM