Home > Back-end >  Why display error C2805: the parameters of the binary "operator==" too little
Why display error C2805: the parameters of the binary "operator==" too little

Time:04-26

Template
Boolean operator==(DoublyList & The list)
{
DoubleNode * p=this - & gt; The head - & gt; next;
DoubleNode * q=list - & gt; The head - & gt; next;
While (p!=NULL& & Q!=NULL)
{
If (p - & gt; The data!=q - & gt; Data)
return false;
The else
{
P=p - & gt; next;
Q=q - & gt; next;
}
}
Return (p==NULL& & Q==NULL);
}

CodePudding user response:

The code is not complete, bad judgment

CodePudding user response:

If you are a class member function, writing in the class, so no template<.> Leading
If you are a class member function, write outside the class, need
Template<.>
Bool DoublyList: : operator==(... );
If it is a friend function requires two parameters
  • Related