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

A Guy With a Question aguywithaquestion at gmail.com
Wed Nov 22 22:50:29 UTC 2017


On Wednesday, 22 November 2017 at 22:45:53 UTC, A Guy With a 
Question wrote:
> On Wednesday, 22 November 2017 at 22:37:46 UTC, Steven 
> Schveighoffer wrote:
>> On 11/22/17 5:36 PM, Steven Schveighoffer wrote:
>>> This allows access to the outer class's members. So you need 
>>> an instance to instantiate.
>>> 
>>> I bet it's the same for interfaces.
>>
>> All that being said, the error message is quite lousy.
>>
>> -Steve
>
> Yup that worked. Thanks!
>
> 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.

Clearly static has a slightly different meaning in D.


More information about the Digitalmars-d-learn mailing list