title: C++ Error: No match for 'operator='
body: <p>Having a problem when assigning a value to an array. I have a class I created called <code>Treasury</code>. I created another class called <code>TradingBook</code> which I want to contain a global array of <code>Treasury</code> that can be accessed from all methods in <code>TradingBook</code>. Here is my header files for TradingBook and Treasury:</p>
  
  <pre><code>class Treasury{
  public:
      Treasury(SBB_instrument_fields bond);
      Treasury();
      double yieldRate;
      short periods;
  };
  
  
  class TradingBook
  {
  public:
      TradingBook(const char* yieldCurvePath, const char* bondPath);
      double getBenchmarkYield(short bPeriods) const;
      void quickSort(int arr[], int left, int right, double index[]);
  
      BaseBond** tradingBook;
      int treasuryCount;
      Treasury* yieldCurve;
      int bondCount;
      void runAnalytics(int i);
  };
  </code></pre>
  
  <p>And here is my main code where I'm getting the error:</p>
  
  <pre><code>TradingBook::TradingBook(const char* yieldCurvePath, const char* bondPath)
  {
      //Loading Yield Curve
      // ...
      yieldCurve = new Treasury[treasuryCount];
  
      int periods[treasuryCount];
      double yields[treasuryCount];
      for (int i=0; i &lt; treasuryCount; i++)
      {
          yieldCurve[i] = new Treasury(treasuries[i]);
          //^^^^^^^^^^^^^^^^LINE WITH ERROR^^^^^^^^^^^^^^
      }
  }
  </code></pre>
  
  <p>I am getting the error:</p>
  
  <blockquote>
    <p>No match for <code>'operator='</code> on the line <code>'yieldCurve[i] = new Treasury(treasuries[i]);'</code></p>
  </blockquote>
  
  <p>Any advice?</p>