• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Need clarification - K&B book

 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Page 36 - Protected Details



The bottom line: when a subclass-outside-the-package inherit a protected member, the member is essentially private inside the subclass,such that only the subclass and its subclasses can access it."



As per the statement, if it is private inside the subclass, then how the subclass' subclasses access the private of its parent class.



My doubt is only in the statement.
[ May 17, 2007: Message edited by: M Krishnan ]
 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you're right, the member is not really private. But for that reason the authors wrote


the member is essentially private inside the subclass


because they wanted to point out, that no other class (excluding subclasses) in the package can acces this member. One could think: ok the inherited member is a protected one, so all classes in packageB (convention: package names always begin with small letters) can access it. The authors made clear that this is not how it works.
 
There is no beard big enough to make me comfortable enough with my masculinity to wear pink. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic