• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

protected access

 
Rishi Wright
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi 'all
say A & B are classes in different PACKAGES
and B extends A
Then
1)how can I call a PROTECTED OVERRIDEN method in A from B
2)How can I access the STATIC PROTECTED method of A from B
a simple example would be more helpfullllll.....
thank you
rishi
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Rishi,
Here is the example,

output is,
B
A
A.protected static:A
You get it?
Regards
Maulin
 
Rishi Wright
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thnx Maulin...I wanted to confirm there is no other way to call superclass overridden method other than using super (I mean any reference variable)..
thnx agian
rishi
 
Selim Hendrickson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maulin I'm confused. I thought the extending class would not be able to invoke protected methods through reference. Is super an exception to this rule?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic