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

Member Avatar for Javam

You have the word something... written above it. Take this out?

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.

@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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.