title: Usage of local class in C++ function
body: <p>I see some usage of internal struct in c++ function.</p>
  
  <p>There is a common interface IBase. Here is the draft code.</p>
  
  <pre><code>class IBase
  {
      virtual Method()=0;
  }
  
  vector&lt;IBase*&gt; baseList;
  </code></pre>
  
  <p>Then a function defined an internal class based on that IBase, and then push the internal class object into the baseList.</p>
  
  <pre><code>void func()
  {
      struct Object : public IBase
      {
          virtual Method()
          {
              // Method of Object in func
          }
      }
  
      IBase* base = new Object();
      baseList-&gt;push(base);
  
  }
  </code></pre>
  
  <p>It seems a strange usage, but a nice implementation of message/event creation pattern.</p>
  
  <p>Other threads maybe use this baseList to handle the incoming event.</p>
  
  <p>What's the scope of internal struct of "struct Object"? It's very interesting. Is there some documents talking about this?</p>