亲爱的大家;
嗨,我只是C++的初学者; 请帮我理解:
Linked list类中应该有哪些函数?我认为应该重载运算符<<和>>; 请帮我改进代码(样式,错误等),谢谢你提前.有约色.
编辑:这只是第一阶段,下一个将(希望)与模板.
请查看整数列表的小代码(包含MyNODE.h和ListDriver1.cpp); MyNODE.h
// This is my first attempt to write linked list. Igal Spector, June 2010.
#include <iostream.h>
#include <assert.h>
//Forward Declaration of the classes:
class ListNode;
class TheLinkedlist;
// Definition of the node (WITH IMPLEMENTATION !!!, without test drive):
class ListNode{
friend class TheLinkedlist;
public:
// constructor:
ListNode(const int& value, ListNode *next= 0);
// note: no destructor, as this handled by TheLinkedList class.
// accessor: return data in the node.
// int …Run Code Online (Sandbox Code Playgroud)