• 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
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • 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.
 
I knew I would regret that burrito. But this tiny ad has never caused regrets:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic