• Post Reply Bookmark Topic Watch Topic
  • New Topic

inner classes static reference ambiguity  RSS feed

 
Upendra Logisa
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



execute the preceeding code and try removing static modifier in the line 25 i.e.,

and observe the line 38 being effected i.e.,

here the method get is also non static. but compiler doesnt prompt static violation for get() where it is saying static reference violation for the method createInner(). why this disparity.

[Edited to add code tags - Paul Sturrock]
[ August 18, 2006: Message edited by: Paul Sturrock ]
 
Serkan Demir
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think your naming policy for classes causes some readibility problems. Class names should start with an uppercase. If it starts with a lower case, static access to methods of classes resembles normal access via an object.
I tried to compile your first version of example class and it compiles.
After i removed static modifier before createInner method, compiler warns me about static method violation.

I can't see any problem. Did you really not get such violation after removing static modifier, could you check your code?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!