Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inheritance: Private Member access from SubClass?

 
Davide Crudo
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

I was reviewing the information about access modifiers inherited from subclasses, and reading the following link:

Sun Java Inheritance Documentation

it says:

[...] If the subclass is in the same package as its parent, it also inherits the package-private members of the parent.[...]


a little below it says:


[...]
A subclass does not inherit the private members of its parent class. [...]


And indeed, private members, package or not, are not visible (unless using setters and getters)...

What does "package-private" members refers to?....

Thanks!
Dave
 
Ninad Kulkarni
Ranch Hand
Posts: 802
Hibernate Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does "package-private" members refers to?....


it refers to default access that means no access modifier.

 
Davide Crudo
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...

Now it makes a little more sense... package-private = default... i was confused by the keyword private ;)

Thank you!
Dave
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic