• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inner class program - giving error

 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


can any body tell why the program is giving error . inner class object can access all the member of outer class then why .... ???

thanks a lot .
[ January 11, 2005: Message edited by: rathi ji ]
 
Arjun Shastry
Ranch Hand
Posts: 1899
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you should define one method inside inner class,call that integer there and then call the method.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Inner does not have a member called i.
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Barry Gaunt:
Inner does not have a member called i.


yes but inner class have access of outer class members . Is this is like that we have to access that member in inner class scope only ...

please reply ...

thanks .
[ January 11, 2005: Message edited by: rathi ji ]
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot ask an instance of Inner what its member i is, because it does not have one. But you can give it a method, getI() say, that returns the value of i from the containing class.
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks barry & all ,
I got the point ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic