Member not accessible in delegate body
Rene Zwanenburg via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Sep 23 08:29:43 PDT 2016
On Friday, 23 September 2016 at 07:54:15 UTC, John C wrote:
> How is it possible that "onTextChanged" isn't accessible but
> the private method "changeSize" *is*?
Smells like an oversight. I guess the compiler doesn't see the
delegate as a member of a Control subclass, so it can't access
protected members. Private works because private in D means
module private.
Please file an issue. As a workaround you can try to take the
address of the method in the closure (untested):
void delegate() foo()
{
auto func = &super.someProtectedFunc;
return () => func(); // I think this will work
}
More information about the Digitalmars-d-learn
mailing list