Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Beginning Java
Assigning weaker privileges
Pratik D mehta
Ranch Hand
Posts: 121
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
class Abb { public void runTo() { System.out.println("Mai Abb ki private method hoon"); } } public class NewClass1 extends Abb { @Override private void runTo() {// Error - attempting to assign weaker privleges. super.runTo(); System.out.println("mai NewClass1 ki private hoon"); } public static void main (String args[]) { NewClass1 n1 = new NewClass1(); n1.runTo(); } }
What are the possible reasons that we cant assign weaker privileges to overridden methods in subclass ?
Understanding is Everything - Peter Lord
Bobby Smallman
Ranch Hand
Posts: 107
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Subclasses must be usable as instances of their super. Reducing visibility would violate this contract.
https://www.securecoding.cert.org/confluence/display/java/SCP01-J.+Do+not+increase+the+accessibility+of+overridden+or+hidden+methods
Everyday in every way, we get a little better.
Pratik D mehta
Ranch Hand
Posts: 121
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thank you I got the visibility modifiers stuff .
Understanding is Everything - Peter Lord
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
problem with implementing interface
interface problem
my problem related to overriding
static method
More...