public class A {
public static A current;
public A() {
current = this;
}
}
I’m considering doing something like the above and was wondering if this kind of thing is frowned upon and why. The reason i’m doing it is because I know there will only ever be one instance of the class A for each instance of my program and almost all classes need to be able to interact with the instance of class A. So I figured this would be a simpler approach than creating all the other classes with a pointer to the only instance of class A.
Thanks for any help,
Nathan