Re: nested functions in VC++



alexl wrote:
I think what I am looking for is a "nested function" which C++ doesn't
officially support.

Actually, you can put a function within a function, but not in the normal sense. Try something like this:

void MyClass::SomeFunction()
{
  struct Inner
  {
    static int InnerWorkings(int i)
    {
      return i * 4;
    }
  };

  printf("Inner function call result: %d\n", Inner::InnerWorkings(5));
}

You would have to wonder why one would do this because for the
most part you shouldn't need to.  However on a few rare occasions
it does come in handy.

Murrgon
.