Forums Register Login

Overriding final methods

+Pie Number of slices to send: Send
Normally methods declared as final cannot be overriden for security / design reasons.

But when a method declared as "private final" can be overriden in the child class. Do we get this behaviour since private members are not accessible in child ?
[ February 17, 2005: Message edited by: Srinivasa Raghavan ]
+Pie Number of slices to send: Send
Private methods in the parent class are not in inherited by the child classes. Hence, having methods of the same signature as well as being declared private & final does not equate to method overriding.

HTH
+Pie Number of slices to send: Send
And it is not just a question of semantics. Overridden methods will show polymorphic behavior but redefining private methods with the same name and signature will not.
She'll be back. I'm just gonna wait here. With this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 630 times.
Similar Threads
Final Question
private methods
can private methods be overridden?
private vs. public
Why call int version,not char version?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 04:44:09.