template<typename Type> class SingleList;
template<typename Type> class ListNode{
private:
friend typename SingleList<Type>;
//this line appears"expected a qualified name after 'typename'"
ListNode():nextNode(NULL){}
ListNode(const Type item,ListNode<Type> *next=NULL):nodeData(item),nextNode(next){}
~ListNode(){
nextNode=NULL;
}
public:
Type GetData();
friend ostream& operator<< <Type>(ostream& ,ListNode<Type>&);
private:
Type nodeData;
ListNode *nextNode;
};
编码:
friend typename SingleList<Type>;
期望在“typename”之后有一个限定名称以及如何解决它。谢谢你。