线性表的合并
template<class T>SeqList<T> SeqList<T>:: Unite(const SeqList<T> lb)
{
SeqList<T> lc(Length()+lb.Length());
Node<T> *currentA=getFirst();
Node<T> *currentB=lb.getFirst();
int a=Length();
int b=lb.Length();
T x;
for(int i=1;i<=a;i++)
{
x=currentA->data;
lc.Insert(i,x);
currentA=currentA->next;
}
for(int j=1;j<=b;j++)
{
x=currentB->data;
if(lc.Search(x)==0)
{lc.Insert(a+j,x);}
currentB=currentB->next;
}
return lc;
}
在main()中调用la.Unite(lb);
c:\users\administrator\desktop\实验二\seqlist.h(219) : error C2664: '__thiscall SeqList<int>::SeqList<int>(const class SeqList<int> &)' : cannot convert parameter 1 from 'int' to 'const class SeqList<int> &'
Reason: cannot convert from 'int' to 'const class SeqList<int>'
No constructor could take the source type, or constructor overload resolution was ambiguous
d:\program files\microsoft visual studio\vc98\include\xstring(79) : while compiling class-template member function 'class SeqList<int> __thiscall SeqList<int>::Unite(const class SeqList<int>)'
执行 cl.exe 时出错.
这是怎么回事啊,大神啊!!!求解!!!!