0

i have a header file defined as :

template <typename NodeElement>
class Node{

	//public members
	public:
                 something here.....
		
	private:
};


template <typename ListElement>

class List{



         public:
               something....
               Node *nodePtr;  //problem here
};
list.h:38: error: ISO C++ forbids declaration of ‘Node’ with no type
list.h:38: error: expected ‘;’ before ‘*’ token

the compiler shows this error.. and i have no idea what is going on..
how should i fix this error?
thanks =D

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by wildplace
0

if Node is a template class, then the way to create an object is to specify the type you want inbetween < and >

Node<int> my_int_Node;
Node<double> my_double_Node;
Node<bool> my_bool_Node;
//etc.
0

@Bench, your words are magic =D.. a big thx... was trying to rep you.. but have no idea where that button is =(
@Javam, sumthing just mean i define something there, anyway , thx for help =D

Edited by wildplace: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.