clarification regarding one of the rules of overriding given in scjp 6 study guide by Kathy and Bert
ajithkumar punnakula
Greenhorn
Joined: Dec 27, 2008
Posts: 8
posted
0
Hi
Did not know if needed to start a new topic or continue an older topic of mine but started a new one.
In the Rules of overriding given in scjp 6 study guide by Kathy and Bert (pg. no. 106)
The rules of overriding a method are as follows:
(5)Instance methods can be overridden only if they are inherited by the subclass. A subclass withing the same package as the instance's super class can override any superclass method that is not marked private or final.
....
(6)...
The Class C3 does not inherit the method met1() from the Class C1, but it overrides the met1(), since met1() is visible in class C3.
So my Question is that rule - a general rule as mentioned in the book ? as I see a contradicting case above or am I missing something.
Thanks in advance
Ajith
Jim Hoglund
Ranch Hand
Joined: Jan 09, 2008
Posts: 525
posted
0
Inheritance and the overriding of non-private methods does not
depend on the class packages. So I am confused about how you
see them linked. Can you explain further? Thanks.
Jim ... ...
BEE MBA PMP SCJP-6
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32638
4
posted
0
You ought to have continued in the old thread, since this appears to be closely related to the old thread. To avoid duplication, I shall close this thread; please continue discussion in the old thread (link in 1st posting), and copy the link to this thread in your replies.