title: Can an existing plain C++ class implement IDL interface without turning into a COM class?
body: <p>I have a COM object, <strong>CProvider</strong>, implemented using ATL. This class encloses another class, <strong>CProviderInfo</strong>, and maintains a static vector of objects of this inner class type. </p>
  
  <p>Here's how it looks like:</p>
  
  <pre><code>//-------------
  // CProvider.h
  //-------------
  
  //
  // COM object class
  //
  class ATL_NO_VTABLE CProvider :
      public CComObjectRootEx&lt;CComMultiThreadModel&gt;,
      public CComCoClass&lt;CProvider, &amp;CLSID_Provider&gt;,
      public Interface1,
      public Interface2
  {
  public:
      BEGIN_COM_MAP(CProvider)
         COM_INTERFACE_ENTRY(Interface1)
         COM_INTERFACE_ENTRY(Interface2)
      END_COM_MAP()
  
      //
      // The inner class
      //
      class CProviderInfo
      {
      public:
          CProviderInfo();
          CComBSTR m_strName;
          GUID m_guidRegistration;
      };
  
  private:
      //
      // static vector of inner class type
      //
      static vector&lt;CProviderInfo&gt; m_vProviderInfo;
  };
  </code></pre>
  
  <p>What I would like to do is introduce a method on <strong>CProvider</strong> that returns a copy of the static vector <strong>m_vProviderInfo</strong>. Trying to play by COM rules, I introduced a new IDL interface <strong>IProviderInfoRetriever</strong> for this purpose:</p>
  
  <pre><code>//---------
  // IDL file
  //---------
  
  //
  // IProviderInfoRetriever interface
  //
  [
      // uuid, version ... etc.
  ]
  interface IProviderInfoRetriever : IUnknown
  {
      HRESULT GetProviderInfo(
          [out, retval] SAFEARRAY(IProviderInfo*) *ppProviderInfo);
  }
  
  //
  // The interface of the class holding the info
  //
  [
      // uuid, version ... etc.
  ]
  interface IProviderInfo : IUnknown
  {
      [propget] 
      HRESULT Name(
          [out, retval] BSTR *pbstrName);
  
      [propget]
      HRESULT Registration(
          [out, retval] GUID *pguidRegistration);
  }
  </code></pre>
  
  <p>My plan is to have <strong>CProvider</strong> implement <strong>IProviderInfoRetriever</strong> effectively copying the contents of the static vector <strong>m_vProviderInfo</strong> into the output SAFEARRAY of <strong>IProviderInfoRetriever::GetProviderInfo()</strong>.</p>
  
  <p>My question is: is it possible to have the inner class <strong>CProviderInfo</strong> implement <strong>IProviderInfo</strong>? Would that break existing code that creates local variables of type <strong>CProviderInfo</strong>?</p>