title: Return value to class object in C++
body: <p>I have a header file:</p>
  
  <pre><code>using namespace std;
  
  class IntList{
  private:
      int *Intl;
      int Capacity;
      int Count;
  public:
      IntList(int capacity){
          Capacity = capacity;
          Count = 0;
          Intl = new int[capacity];
      }
  
      ~IntList(){
          delete Intl;
      }
  
      //adds the integers of the specified collection to the end of the List; return false if the new Count will be greater than Capacity
      bool AddRange(const IntList &amp;items){
          //int *Temp = items.;
          if(items.Count &gt; Capacity - Count){
              return false;
          }else{
              for(int i = 0; i &lt;items.Count; i++){
                  Intl[Count] = items.Intl[i];
                  Count++;
              }
              return true;
          }
      }
  };
  </code></pre>
  
  <p>But I don't know why I can't return value to IntList object in there:</p>
  
  <pre><code>//creates a copy of a range of elements in the source List
          IntList GetRange(int index, int count){
              IntList A(count);
              for(int i = 0; i &lt; count; i++){
                  A.Intl[i] = Intl[index -1 +i];
              }   
              return A;
          }
  </code></pre>
  
  <p>I want to return value of <code>A</code> whose type is <code>IntList</code> but I meet an error on <code>"_BLOCK_TYPE_IS_VALID(pHead-&gt;nBlockUse)</code> in visual studio 2010. How can I repair it?</p>