libin7099901
有关链表
>>
完整版
[mw_shl_code=cpp,true]class Link{
public:
int data;
Link *next;
Link(const int info, Link *nextValue = NULL){
data = info;
next = nextValue;
}
Link(Link *nextValue){
next = nextValue;
}
};
class linkList:public Link{
private:
Link *head, *tail;
Link *setPos(const int p);
public:
linkList(int s);
~linkList();
bool isEmpty();
bool sort();
bool uniq();
void clear();
int length();
bool append(const int value);
bool insert(const int p, const int value);
bool _delete(const int p);
bool getValue(const int p, int& value);
bool getPos(int &p, const int value);
};
linkList::linkList(int s){
head = tail = new Link(s);
}[/mw_shl_code]
我很好奇为什么最后那个函数会提示我"error C2512: “Link”: 没有合适的默认构造函数可用"
呢....他是哪用到了构造函数啊- -...