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;
};
The code:
friend typename SingleList<Type>;
expected a qualified name after 'typename' and how to solve it. Thank you.
You want
friend class SingleList<Type>;
typename
can be used instead of class
inside the template parameter declaration, but not everywhere.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With