In a YouTube video someone made two classes in Java like this:
public class Var {
    static JFrame jf1;
    static int screenWidth = 800;
    static int screenHeight = 600;
    public Var() {
    }
}
public class Gui {
    public Gui() {
        Var.jf1 = new JFrame();
        Var.jf1.setSize(Var.screenWidth, Var.screenHeight);
    }
}
As you can see he can access jf1 by just putting Var. in front of the variable.
Can you access member variables in C++ like this as well? Or do I have to create a GetValue function which returns the variable I want to have in a different class?
 
     
    