aspose file tools*
The moose likes Beginning Java and the fly likes Protected Constructed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Protected Constructed" Watch "Protected Constructed" New topic
Author

Protected Constructed

abin joy
Ranch Hand

Joined: Jul 29, 2008
Posts: 35
What does a protected constructor for a class mean?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

It means that constructor cannot be used by a class outside that particular package (unless the calling class extends the class with the protected constructor).

Why you might use a protected constructor is harder to explain. One possible implementation could be in some sort of creation pattern where all the classes that participate in the pattern sit in one package and you don't want classes outside this calling the constructor directly.
[ September 02, 2008: Message edited by: Paul Sturrock ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Protected Constructed