书上的例子,把程序分成3个部分,我是把这三个程序分别存储在名为
node.h,node.cpp,nn.cpp的文件中,这样不对么?为什么不能运行???

[color=00FFFF]namespace linkedlistofclasses

class Node
{
public: 
Node();
Node (int value,Node *next);

int getdata() const;

Node *getlink() const;

void setdata(int value);

void setlink(Node *next);

friend void reverse(Node *head,Node *top);

private:
    int data;
    Node* link;
};
typedef Node* nodeptr;
}
`````````````````````````````````````````````````
#include <iostream>
#include "n.h"
namespace linkedlistofclasses
{   Node::Node():data(0),link(NULL)
{
}
Node::Node(int value,Node *next):data(value),link(next)
{
}
int Node::getdata()const
{return data;
}
Node* Node::getlink()const
{ return link;
}
void Node::setdata(int value)
{data=value;
}
void Node::setlink(Node *next)
{ link=next;
}
}[/color]`````````````````````````````````````````````````
[color=FF0000]#include <iostream>
#include "n.h"
using namespace std;
using namespace linkedlistofclasses;
void head_insert(nodeptr &head,int the_number)
{ nodeptr temp_ptr;
temp_ptr=new Node(the_number,head);
head=temp_ptr;
}

int main()
{ nodeptr head,tmp;
head=new Node(0,NULL);
for(int i=0;i<5;i++)
{head_insert(head,i);
}
tmp=head;
while(tmp!=NULL)
{cout<<tmp->getdata()<<endl;
tmp=tmp->getlink();
}
tmp=head;
while(tmp!=NULL)
{nodeptr nodetodelete=tmp;
tmp=tmp->getlink();
delete nodetodelete;
}
return 0;
}[/color]