hi there!
i have a class A that needs to instantiate a second class B, whose constructor needs a reference to the same object of class A...
would look like:
public class A {
B b;
public A() {
b = new B(this);
}
}
public class B {
A a;
public B(A a) {
this.a = a;
}
}
well - eclipse keeps complaining that this isnt possible. i assume, this is because the reference of class A isnt "ready" yet at this moment...? but the error wont go away if i move the init of class B to a seperate function within A wich i would call from "outside"...
how can i pass this self-reference from outside to the constructor of B?