private class calling a method from its outer class
- by oxinabox.ucc.asn.au
Ok, so I have a class for a "Advanced Data Structure" (in this case a kinda tree)
SO I implimented a Iterator as a private class with in it.
So the iterator needs to implement a remove function to remove the last retuirned element.
now my ADT already impliments a remove function,
and in this case there is very little (thinking about it, i think nothing) to be gain by implimenting a different remove function for the iterator.
so how do I go about calling the remove from my ADT
sketch of my struture:
public class ADT {
...
private class ADT_Iterator impliments java.util.Itorator{
...
public void remove(){
//where I want to call the ADT's remove function from
}
...
public void remove( Object paramFoo )
{
...
}
...
}
So just calling remove(FooInstance) won't work (will it?)
and this.remove(FooInstance) is the same thing.
what do i call?
(and changign the name of the ADT's remove function is not an option, as that AD T has to meet an Interace wich I am note at liberty to change)
I could make both of them call a removeHelper functon, I guess...