Member functions with access to local variables
Vladimir Panteleev
vladimir at thecybershadow.net
Tue Apr 9 05:22:55 PDT 2013
On Monday, 8 April 2013 at 23:43:45 UTC, Linden Krouse wrote:
> Is there a way to have a function be both a nested function and
> a member function of a different class?
You could use inheritance:
class A
{
int i;
int f() { return i; }
}
void main()
{
int j;
class B : A
{
override int f() { return i + j; }
}
}
In the future, consider posting such questions to
digitalmars.D.learn.
More information about the Digitalmars-d
mailing list