twc
Posts: 129
Nickname: twc
Registered: Feb, 2004
|
|
Re: Question On Nesting A Class Within A Method
|
Posted: Mar 8, 2004 8:47 PM
|
|
Not without casting. This goes back to what I was explaining about interfaces in one of the other posts. Since you have mi declared as a MyInterface object, the compiler only "knows" about the printPrivString() method since that is the only one guaranteed to be there by the interface.
If you either declare it or typecast it to a NestedClass object, then the compiler can read the NestedClass file to see what other methods a NestedClass object contains. (Disclaimer: I've never seen a class declared in a method like this, so I don't even know if you *can* declare or typecast it.)
twc
|
|