Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-11-2007, 10:55 PM
Member
 
Join Date: Nov 2007
Posts: 35
java_fun2007 is on a distinguished road
which class is superclass and subclass?
hi all,
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
http://img401.imageshack.us/img401/1390/examplewt6.png

thanks

Last edited by java_fun2007 : 12-11-2007 at 11:11 PM. Reason: to add more info
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract superclass(I) JavaForums Java Blogs 0 03-12-2008 12:40 AM
subclass vs inner class bugger New To Java 1 01-13-2008 09:31 PM
SuperClass of an Object Java Tip Java Tips 0 12-06-2007 04:51 PM
SubClass problems ravian New To Java 1 11-19-2007 07:54 PM
Getting name of superclass (Example: ArithmeticException) Java Tip Java Tips 0 11-12-2007 01:53 PM


All times are GMT +3. The time now is 04:43 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org