Error "Outer Function Context is Needed" when class declared in unittest

Vijay Nayar madric at gmail.com
Thu Jan 5 17:15:24 UTC 2023


On Thursday, 5 January 2023 at 16:41:32 UTC, Adam D Ruppe wrote:
> On Thursday, 5 January 2023 at 16:38:49 UTC, Vijay Nayar wrote:
>> Does that class inherit the scope of the function it is 
>> inside, similar to how an inner class does with an outer class?
>
> yup. They can see the local variables from the function.

Glad to learn that. Having worked many years in the Java world, 
where basically "class" and "scope" are nearly synonymous, I just 
assumed that classes could only get the scope of other classes, 
it never occurred to me that it could get a scope from a function.

Thanks for the explanation!


More information about the Digitalmars-d-learn mailing list