On Tuesday, 9 April 2013 at 12:22:56 UTC, Vladimir Panteleev wrote:
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.

Ah sorry, it was also kind of a suggestion but mostly a question.
Also the second class is mostly unrelated to the first and they both inherit from another classes already.

Reply via email to