c++ - Copy Constructor not working for Circular Queue? -


I am trying to make a copy of the object, which is a circular quote. My enqueue and decree works correctly, but whenever I do this, I get a runtime error.

  CQUEUE j = k;   

Output window says that my copy maker is recursive on all control paths? Can anyone help me to understand that I am doing wrong? Here is my copy constructor with the overloaded assignment operator.

  Kwai: Qwoi (Constaquo and original) {(* this) = Original; } Zero sequ: :: operator = (QWW) {qnode * p = w.front; (* This) .front = new qnode; (* This) .back = front; While (P -> Next! = W.back) {Back - & gt; Num = p - & gt; Number; P = P - & gt; the upcoming; Back - & gt; Next = new qnode; Back = back - & gt; the upcoming; } Back - & gt; Num = p - & gt; Number; P = P - & gt; the upcoming; Back - & gt; Next = new qnode; Back = back - & gt; the upcoming; Back - & gt; Num = p - & gt; Number; Back - & gt; Next = front; Front - & gt; Prev = back; }    

(* this) = original;

The compiler is calling this line to the copy constructor instead of your = operator, because your = operator currently takes non-constru, left-value sequence is. Instead, your = operator should look like this:

  Cancel Zero: Operator = (Constwive & amp; w)   

Then your Copy creator instead of Operator = Optionally, clarify this more:

  Quwiv :: Quwoi (Const. Quo and original) {copy (original); } Zero Sequo .: Operator = (Constaq & W) {Copy (W); } Zero Sequo: Copy (Const Quiveau and others) {// all your copy codes are here}   

Edit: Yes, you are right, you still need a copy constructor . / P>

Comments