• Post Reply Bookmark Topic Watch Topic
  • New Topic

Protected confusion..  RSS feed

 
Mohnish Khiani
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator





There are errors on line :5,6,7,8
and no error on line :3,4

Please explain how ?
 
Ogeh Ikem
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class B can access a protected member declared in class A (located in a different package), only through inheritance i.e. only through a reference which is of type B (or a subclass of B).

class C can access a protected member declared in class A (located in a different package), only through inheritance i.e. only through a reference which is of type C (or a subclass of C).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!