So I've been double checking on nested classes to make sure I'm not going crazy. Given something like
class Outer{
class Inner{
int y = 0;
void changeOuter();
];
int x = 0;
Inner instance{};
};
I feel like within the changeOuter function I should be able to access the outer class variable without needing to pass a pointer, since firstly, the inner class already knows where it is in memory (with the hidden &self parameter) and secondly knows it's an inner class. But all the examples I see online only mention passing the outer class as a pointer or reference to the inner class methods. Is this still how I'm supposed to do it or am I missing something?
I guess it would have to be static since the inner class doesn't really have a way of knowing if the outer class variable is static or not
With what I'm doing now, my current options are either passing a reference to the outer class to every inner class function or storing a reference to the outer class inside the inner class, which I'm not too fond of in the case of having an array made of the inner class... feels like duplicate data. Would making the inner class's pointer to the outer class a static member mean all instances of every inner class, no matter where, will point to the same outer class (which I also don't want either)?