I got a struct S as nested declaration in a class C, where I'd like to refere to members of C in the constructor of S:
public class C {
private int class_state = 0;
private struct S {
public int struct_state;
public S () {
struct_state = class_state;
}
}
public void foo (int state) {
class_state = state;
}
public void bar () {
S s = new S();
}
}
Yielding an error, that class_state is non-static and therefore needs an reference to an instance of C.
Is there an implicit way to tell struct S to reference the instance it is instanciated in?
thisto the constructor ofS?