How can I get an!_NEWLINE_!instance of non static inner class?
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Alexey_Kropotin
Posted On:   Monday, July 16, 2001 08:44 AM


How can I get an instance of non static inner class if I can invoke only outer class constructor?
May be inner instance will be created with outer?

Re: How can I get an!_NEWLINE_!instance of non static inner class?

Posted By:   Rob_Smallwood  
Posted On:   Friday, July 20, 2001 05:20 AM

Use the syntax




Outer.Inner i = new Outer().new Inner();



- or -



Outer o = new Outer();


Outer.Inner i = o.new Inner();

Re: How can I get an!_NEWLINE_!instance of non static inner class?

Posted By:   John_Mitchell  
Posted On:   Monday, July 16, 2001 11:41 AM

Why are you trying violate the encapsulation that the outer class has created? I.e., if the outer class hasn't given you a way to directly access/manipulate the inner class, then it's probably not a good idea.
About | Sitemap | Contact