this
内部クラスで外部クラスからのポインターを使用する必要があります。
this
ポインターを保存せずにそれを行う方法がわかりません。代替手段はありますか?
class outerclass {
outerClass thisPointer;
outerclass () {
//
// NOTE: I am saving this pointer here to reference
// by the inner class later. I am trying to find
// a different alternative instead of saving this pointer.
//
thisPointer = this;
}
class innerClass {
void doSomething () {
//
// is there a way to reference the outter class
// without having to save the thisPointer from
// the outter class.
// NOTE someObject is a class outside of the
// outterclass control.
//
someObject.someMethod (thisPointer);
}
}
}