clarification regarding one of the rules of overriding given in scjp 6 study guide by Kathy and Bert
Joined: Dec 27, 2008
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.
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
Joined: Jan 09, 2008
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
Joined: Oct 13, 2005
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.