Error: 'this' is only defined in non-static member functions

Jonathan M Davis newsgroup.d at jmdavisprog.com
Thu Nov 23 01:06:12 UTC 2017


On Thursday, November 23, 2017 00:49:33 Mike Parker via Digitalmars-d-learn 
wrote:
> On Wednesday, 22 November 2017 at 22:45:53 UTC, A Guy With a
>
> Question wrote:
> > Out of curiosity, what does static mean in that context? When I
> > think of a static class I think of them in the context of Java
> > or C# where they can't be instantiated and where they are more
> > like namespaces that you can't directly import the contents of.
>
> Actually, they work exactly like Java's static nested classes in
> this context.
>
>
> class OuterClass {
>      ...
>      static class StaticNestedClass {
>          ...
>      }
> }
>
> OuterClass.StaticNestedClass nestedObject =
>       new OuterClass.StaticNestedClass();
>
> https://docs.oracle.com/javase/tutorial/java/javaOO/nested.html

I thought that that was the case, but my Java is so rusty that I wasn't
sure.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list