Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can a contructor be declared protected...

 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the code compiles....but what is the use of a protected contructor when they are never inherited?
 
Ankit Garg
Sheriff
Posts: 9528
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I see correctly, the heading says "can a contructor be declared postive? " . A protected constructor allows the class to be inherited but cannot be instantiated outside of the package. So if a class com.mypackage.MyClass has protected constructor(s), then the MyClass can be inherited but cannot be instantiated outside of com.mypackage package...
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Ankit

Raju
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic