C++ – What’s the point of nested classes?

I’m studying a little of C++ and now I’m fighting against it’s similitudes with Java. First of all be aware that C++ nested classes are similar to what in Java you call static nested classes. There isn’t anything in C++ syntax to reproduce Java nested classes. I discover that private attributes of “container” class are … Read more

Accessing outer class variable in inner class

Assuming your outer class is called Outer, from the scope of the inner class(non-static), Outer.this.foo to get at the field. For example, Outer.this.foo=new ArrayList<>(); where Outer is the name of the class and foo identifies the field. You can also grab it directly as foo=new Baz() but it’ll pick the inner field if there’s a … Read more

Strange syntax for instantiating an inner class

Inner classes (like Button.ClickEvent) need a reference to an instance of the outer class (Button). That syntax creates a new instance of Button.ClickEvent with its outer class reference set to the value of button. Here’s an example – ignore the lack of encapsulation etc, it’s just for the purposes of demonstration: class Outer { String … Read more

Method local inner class vs inner class

I guess you expected the local class method to be invoked. That didn’t happen, because you’re using new A() outside the scope of local class. So, it accesses the next closer candidate in scope, that would be the inner class. From JLS §6.3: The scope of a local class declaration immediately enclosed by a block … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)