title: Overload + operator for integer array, What's difference between two function const and without const at right?
body: <p>This is class of array to access the array of IntegerSet.
  You need access to the pointer <strong>ptr</strong> of IntegerSet <strong>GetPtr()</strong>;</p>
  
  <p>You need access to the <strong>capacity</strong> of IntegerSet <strong>GetCapacity()</strong>;</p>
  
  <p><strong>GetPtr() const</strong> to const IntegerSet class. </p>
  
  <pre><code>class IntegerSet
  {
   private:
      int capacity;
      int nelements;
      int * ptr;
  public :
  IntegerSet(int  size);
  ~IntegerSet();
  int * GetPtr() const {return ptr;};
  int Getcapacity() const {return capacity;};
  IntegerSet &amp;  operator =(const IntegerSet &amp; rhs1);
  friend IntegerSet  operator +(const IntegerSet &amp; rhs1,const IntegerSet &amp; rhs2);
  };
  
  IntegerSet::IntegerSet(int  size)
  {
  ptr=null;
  capacity = size;
  ptr = new int [capacity];
  if(ptr==null) cout &lt;&lt; "error allocation"&lt;&lt; endl;
  
  }
  ~IntegerSet()
  {
  if (ptr) delete ptr;
  }
  IntegerSet &amp; IntegerSet::operator =(const IntegerSet &amp; rhs1)
  {
  int capacity_=rhs1.Getcapacity();
  int *rptr1=rhs1.GetPtr();
  for (int i=0;i&lt;capacity_;i++)
  {
  ptr[i]=rptr1[i]; // ptr is pointer of class IntegerSet 
  }
  return *this;
  }
   //this function friend of class IntegerSet is extern ..
  IntegerSet  operator +(const IntegerSet &amp; rhs1,const int&amp; rhs2)
  {
  int capacity_=rhs1.Getcapacity();
  IntegerSet  temp(capacity_);
  int *rptr1=rhs1.GetPtr();
  int *tptr=temp.GetPtr();
  for (int i=0;i&lt;capacity_;i++)
  {
  tptr[i]=rptr1[i]+rhs2;
  }
  return temp;
  }
  </code></pre>
  
  <p>what's difference between two function <strong>int * GetPtr() const</strong> and <strong>int * GetPtr();</strong> ?</p>