*
The moose likes Beginning Java and the fly likes Assigning weaker privileges Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Assigning weaker privileges " Watch "Assigning weaker privileges " New topic
Author

Assigning weaker privileges

Pratik D mehta
Ranch Hand

Joined: Jul 29, 2010
Posts: 121



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

Joined: Sep 09, 2010
Posts: 107
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

Joined: Jul 29, 2010
Posts: 121

Thank you I got the visibility modifiers stuff .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Assigning weaker privileges