• Post Reply Bookmark Topic Watch Topic
  • New Topic

question on overriding  RSS feed

 
ramu ta
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do we access the private instance variables of super class from sub class methods?
 
Mike Simmons
Ranch Hand
Posts: 3090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. That's what 'protected' is for. With 'private', you have no access from a subclass.
 
Campbell Ritchie
Marshal
Posts: 55768
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can always use the getXXX methods for access to them. Beware: if whoever wrote the superclass wanted the fields private, there was probably a good reason for that.
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And why didn't you try it out? That way you'll learn much more then from asking us.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!