Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

instantiating an inner member class

 
Marlene Miller
Ranch Hand
Posts: 1392
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not a question.
Various ways to instantiate a non-static member class.

[ August 13, 2003: Message edited by: Marlene Miller ]
 
venu gopal
Ranch Hand
Posts: 40
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Marlene this is a great posting, thank you. It covers everything required for inner class instantiation. Could you please add for static and anonymous also?
[ August 13, 2003: Message edited by: venu gopal ]
 
Marlene Miller
Ranch Hand
Posts: 1392
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Venu for reading my posting. Thank you for your response. That's a good suggestion. I will try to do something for those other classes, now that I know it might be helpful.
 
Marlene Miller
Ranch Hand
Posts: 1392
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Various ways to instantiate a static member class.

[ August 13, 2003: Message edited by: Marlene Miller ]
 
Marlene Miller
Ranch Hand
Posts: 1392
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some anonymous class instantiations.

Note: A is not final
[ August 14, 2003: Message edited by: Marlene Miller ]
 
Marlene Miller
Ranch Hand
Posts: 1392
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A thought about instantiating anonymous subclasses of nested classes.
I think it is safe to say,
If C is a top-level, static member, non-static member or local class,
and C is not final, then where ever this is valid syntax to instantiate the class,
new C()
new Outer.C()
outerRef.new C()
new Outer().new C()
this is also valid syntax to instantiate an anonymous class.
new C() { <body of anon class> }
new Outer.C() { <body of anon class> }
outerRef.new C() { <body of anon class> }
new Outer().new C() { <body of anon class> }
[ August 14, 2003: Message edited by: Marlene Miller ]
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please add for static and anonymous also?
Why no local?
Looking good, Marlene. Thanks for posting these.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic