因为最近呢开始用清华大学出版社的那本数据结构自学,真正脱离书本写了一个队列,还是出了点问题的。
template <typename T>
class LQueue
{
public:
LQueue();
~LQueue();
bool EnQueue(const T& x);
bool DeQueue(T& x);
int getSize() const;
bool getHead(T& x) const;
bool IsEmpty() const{ return head->link == NULL; }
void makeEmpty();
friend ostream& operator<< (ostream& out, LQueue<T>& Q);
private:
LinkNode<T>* rear, * head;
};
template <typename T>
ostream& operator<< (ostream& out, LQueue<T>& Q){
LinkNode<T>* current = Q.head->link;
int i = 0;
while (current != NULL){
i++;
out << "#" << i << ":" << current->data << endl;
current = current->link;
}
return out;
};
当我在main中调用输出流的时候,竟然链接器报错!!
我一共只有这两个文件啊,一个头文件,一个main,我也知道模板类声明和实现要一起写的啊,然而,然而。。他就是报错,还linker的错误,又不能调试,又不知道具体问题在哪 ,无比奔溃,查了一个多小时,还和以前程序书上对了个比(我写的

最低0.47元/天 解锁文章
5236

被折叠的 条评论
为什么被折叠?



