title: Error using CArray: cannot access private member declared in class CObject
body: <p>I've created a dll using Microsoft Visual Studio 2010 and all works fine; now I want to add a member variable to the class I export; this member variable is a vector of struct which contains a CArray of another struct. The error I have in debug mode is </p>
  
  <blockquote>
  <pre><code>error C2248: 'CObject::CObject': cannot access private member declared in class 'CObject'
  c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxtempl.h  262
  </code></pre>
  </blockquote>
  
  <p>I know I get this error because there a problem with the constructor of the struct which contains the CArray but I'm not able to fix it. Please help me.
  Below I posted the code.</p>
  
  <p>EXPORTED CLASS:</p>
  
  <pre><code>namespace optFun
  {
      // si posso definire altri casi in base a dove vengono collocati gli strumenti di gestione delle eccezioni
      enum RETURN{
          RETURN_INIT=0,
          RETURN_ERRORINREADING,
          RETURN_ERRORINPARALLEL,
          RETURN_ERRORINMAKESPAN,
          RETURN_SUCCESSFUL
      };
  
      struct DataPrescription{
      EDrug  NameDrug;
      float Dosage;
      EContainerType DestType;
      ELiquid IdDest;
      float CapacityDest;
      float Priority;
      bool ScaricoShaker;
      int  BlockNumber;
  
      DataPrescription(){
          NameDrug=EDrug_NoDrug;
          Dosage=0.0;
          DestType= EContainerType_Tot;
          IdDest=ELiquid_NoLiquid;
          CapacityDest=0.0;
          Priority=0.0;
          ScaricoShaker=true;
          BlockNumber=0;
      }
  
      DataPrescription(EDrug name,float dos,EContainerType dest,ELiquid ID,float cap_dest,float p,bool _ScaricoShaker,int _BlockNumber){
          NameDrug=name;
          Dosage=dos;
          DestType=dest;
          IdDest=ID;
          CapacityDest=cap_dest;
          Priority=p;
          ScaricoShaker=_ScaricoShaker;
          BlockNumber=_BlockNumber;
      }
  };
  
  struct final_block{
  
    CArray&lt;DataPrescription&gt; block_list;
    vector&lt;load_info&gt; carico;
    bool scarico_MI;
    final_block(){
        scarico_MI=false;
    }
  };
      // This class is exported from the optFunDll.dll
      class OPTFUNDLL_API OptimizationTool
      {
      public: 
          // funzione che implementa il modulo di ottimizzazione
          CArray&lt;DataPrescription&gt; OptList;
          time_info time;
          vector&lt;final_block&gt; execution_mode;
          vector&lt;state_info&gt; StatusInfo;
          vector&lt;load_info&gt; LoadIndication;
          CArray&lt;DataPrescription&gt; ShakingList; //lista dei soli farmaci da restituire nell'ordine ottimo di schedulazione
  
          OptimizationTool(void);
          ~OptimizationTool();
  
          void CreateDataPrescription(vector&lt;block&gt;&amp;);
          //void CreateBlockPrescription(block&amp;); 
          RETURN scheduling(vector&lt;string&gt;,const char*,const char*,const char*);
          void InitializeParameter(double,int);
          void LoadDetails(vector&lt;block&gt;&amp;,vector&lt;magazzino_ospedale&gt;&amp;);
          //void ToLoad(ricetta&amp;,vector&lt;magazzino_ospedale&gt;&amp;,vector&lt;magazzino_ospedale&gt;&amp;);
          void SyncronizeLoad(vector&lt;block&gt;&amp;);
  
          // accessor function
          double get_PercVel();
          int get_CountSame();
  
  
      private:
          double _PercentMaximumVelocityOfSearchSpace; // % che determina range di variazione della velocità (e quindi anche della posizione)
          int _CountSame; // numero di stesse iterazioni dopo le quali la procedura di ottimizzazione si arresta
  
  
      };
  }
  </code></pre>
  
  <p>The struct which give me error is "final_block"; I used this struct in this way:</p>
  
  <pre><code>for(unsigned int i=0;i&lt;output.size();i++){
             final_block pr;
             for(unsigned int j=0;j&lt;output[i].list.size();j++){
                 DataPrescription tmp(output[i].list[j].getID(),output[i].list[j].getdosage(),output[i].list[j].get_destination(),output[i].list[j].get_DestType(),output[i].list[j].get_CapacityDest(),output[i].list[j].getPriority(),output[i].list[j].processing_info.scarico_shaker,i+1);
                 pr.block_list.Add(tmp);
             }
             pr.carico.push_back(this-&gt;LoadIndication[i]);
             pr.scarico_MI=output[i].scarico_MI;
            this-&gt;execution_mode.push_back(pr);
         }
  </code></pre>
  
  <p>Thanks in advance for your help.</p>