Results 1 to 7 of 7
Thread: Superclass question
- 10-11-2010, 10:27 AM #1
Member
- Join Date
- May 2010
- Posts
- 34
- Rep Power
- 0
- 10-11-2010, 11:06 AM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,568
- Rep Power
- 15
Why would you need to "check which class requested it"?
In any case, if the signatures are not the same (and they are not when there are different arguments) then it does not belong in some abstract "super" class.
- 10-11-2010, 11:16 AM #3
Member
- Join Date
- May 2010
- Posts
- 34
- Rep Power
- 0
The method signatures are the same, but the bodys are different, and will cause action to variables belonging uniquely to each class.
- 10-11-2010, 11:29 AM #4
Senior Member
- Join Date
- Oct 2010
- Posts
- 393
- Rep Power
- 11
Keo,
You could just leave them as is, but I would place an abstract method in the super class to ensure consistancy. This does mean that ALL sub-classes must override the method, but it does make calling the method from an array of different sub-classes easier.
Regards.
- 10-11-2010, 11:43 AM #5
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,568
- Rep Power
- 15
- 10-11-2010, 11:45 AM #6
Member
- Join Date
- May 2010
- Posts
- 34
- Rep Power
- 0
Okay, Thank you everyone!
- 10-11-2010, 11:48 AM #7
Senior Member
- Join Date
- Oct 2010
- Posts
- 393
- Rep Power
- 11
Similar Threads
-
Class and SuperClass
By pompeez in forum New To JavaReplies: 2Last Post: 08-05-2009, 10:55 AM -
superclass and subclass
By mr idiot in forum New To JavaReplies: 19Last Post: 01-03-2009, 07:29 AM -
SuperClass of an Object
By Java Tip in forum Java TipReplies: 0Last Post: 12-06-2007, 02:51 PM -
Getting name of superclass (Example: ArithmeticException)
By Java Tip in forum Java TipReplies: 0Last Post: 11-12-2007, 11:53 AM
Bookmarks