0
template <class Type>
class Node
{
public:
Node()
{
}
Node (Type x, Node* nd)
{
data = x;
next = nd;
}
Node (Type x)
{
data = x;
next = NULL;
}
~Node (void)
{
}
Node (const Node* & nd)
{
data = nd->data;
next = nd->next;
}
Node & Node::operator = (const Node* & nd)
{
data = nd->data;
next = nd->next;
}
T data;
Node* next;
};
难道我更换每一个节点*与转换为模板类(节点)
Node*<Type>
我试图取代它,并试图运行像
Node* temp = myq.head;
但它说类参数列表模板“节点”丢失。当我需要节点类本身作为它的一部分时,我不太确定如何使用模板
什么'myq.head'?它是如何定义的? – billz
my.qhead只是另一个Node对象,技术上它应该是。但现在它真的不是因为myq.head不会被首先定义的 – user2472706
我们在前几天有一个类似的问题,请看这里:http://stackoverflow.com/a/19034786/1529139 – 56ka