title: Swap two objects of class
body: <p>my class has some private and public elements. Now how can i swap two objects of class?
  I wrote a swap function like this in my class:</p>
  <pre><code>void swap(class &amp;A,class &amp;B)
  {
     class temp=*A;
     *A=*B;
     *B=temp;
  }
  </code></pre>
  <p>can this function swap all of the elements?(even private one or no)</p>