e(); i++)Р cout << A.Get(i) << " ";Р?cout << endl;Р?// 友元函数调用Р?cout << "模板输出结果:\n";Р?cout << A << endl;Р?cout << B << endl;Р?cout << R << endl;Р?Р?return 0;Р}Р4、添加类的实现代码(链表)Р1)链表的实现函数Р// 构造函数РLinkedList::LinkedList()Р: size(0)Р, head(NULL)Р{Р}РLinkedList::LinkedList(int MaxSize)Р: _size(MaxSize)Р, _head(NULL)Р{Р}Рint LinkedList::Length() constР{Р?return size;Р}Р// 返回元素x所在的位置,第一个节点序号为1Рint LinkedList::Search(Type& x) constР{Р?if (NULL == head)Р return -1;Р?int result = 1;Р?ListNode *cur;Р?cur = head;Р?while (cur != NULL)Р?{Р if (cur->data == x)Р return result;Р elseР {Р cur = cur->next;Р result++;Р }Р?}Р?return -1;?Р}Рint LinkedList::Insert(Type& x, int i)Р{Р?if (i <= 0)?// 越界Р return -1;Р?if (size == 0)Р?{Р // 插入结点操作Р ListNode *temLN = new ListNode();Р temLN->data = x;Р temLN->link = NULL;