title: copy constructor for a linked list classes
body: <p>So I want to copy a whole linked list classes, I have trouble figuring it out how to do so, </p>
  
  <pre><code>class list{
     public:
    list(const list &amp;t);
  private:
    struct Node{
      int x;
      Node *next;
    }*p;
  </code></pre>
  
  <p>I started with something like this:</p>
  
  <pre><code>list::list(const list &amp;t){
    Node* q;
    q=new Node;
    while (p!=NULL){
      q-&gt;x= p-&gt;x;}
  }
  </code></pre>
  
  <p>but I'm not sure if I am on the right track or what. I also have trouble how should I test such a copy constructor? For example I have list l1, then i insert couple integers into a list and then how I can copy it? </p>