#include<iostream>
using namespace std;
template<class T>
class List  
{
public:
void clear();
bool isEmpty();
bool append(const T value);
bool insert(const int p,const T value);
bool deleteElement(const int p);
bool getValue(const int p,T&value);
bool setValue(const int p,const T value);
bool getPos(int &p,const T value);
};template<class T>
class Link
{
public:
T data;
Link<T> *next;
Link(const T info, Link<T>*nextValue = NULL)
{
data = info;
next = nextValue;
}
Link(const Link<T>* nextValue)
{
           next = nextValue;
}
};
template<class T>
class lnkList:public List<T>
{
private:
Link<T> *head,*tail; //单链表的头尾、指针
Link<T> *setPos(const int p);//返回线性表指向第p个元素的指针值
public:
lnkList(int s);
lnkList();
~lnkList();
bool isEmpty();
void clear();
int length();
bool append(const T value);
bool insert(const int p,const T value);
bool del(const int p);
bool getValue(const int p,T&bvalue);
bool getPos(int&p,const T value);};template<class T>
lnkList<T>::lnkList(int s)
{
head=tail=new Link<T>;
}
template<class T>
lnkList<T>::~lnkList()
{
Link<T> *tem;
while(head!=NULL)
{
tem = head;
head = head->next;
delete tem;
}
}
template<class T>
Link<T> *lnkList<T>::setPos(int i)
{
int count = 0;
if(i == -1)
return head;
Link<T> *p = new Link<T>(head->next);
while(p!=NULL && count<i)
{
p = p->next;
count++:
}
return p;
}
template<class T>
bool lnkList<T>::insert(const int i,const T value)
{
Link<T> *p,*q;
if((p=setPos(i-1)) == NULL)
{
cout<<"非法插入"<<endl;
return false;
}
q =new Link<T>(value,p->next);
p->next = q;
if(p==tail)
tail = q;
return true;
}
void main()
{
   lnkList<int> at(10);
   
}
但是为什么一直出错,请求大神给与指点c++ 模版单链表