类节点没有命名成员
Class node has no member named
我已声明此功能
template<class ItemType>
LinkedBag<ItemType> LinkedBag<ItemType>::bagUnion(LinkedBag<ItemType> otherBag)
{
LinkedBag<ItemType> unionBag; // create a new Bag
Node<ItemType>* curPtr = headPtr; // get a pointer to the beginning of the invoking bags list
for(int i=0; i<getCurrentSize(); i++) // for each item in the list ...
{
unionBag.add( curPtr->getItem() ); // add the item to the new bag
curPtr = curPtr->getNext(); // cycle to the next item (needed for linked list)
}
curPtr = otherBag.headPtr;
for(int j=0;j<otherBag.getCurrentSize(); j++)
{
unionBag.add(curPtr->getItems()); //add the item to unionBag
curPtr = curPtr->getNext();// cycle to the next Item
}
return unionBag;
}
这是我遇到的错误
bagtester.cpp:70:56:此处需要
的成员
linkedbag.cpp:244:7:错误:'class node>'没有名为'getItems()'
您制作了错字。您写了getItems
而不是getItem
。
请收听错误消息并在发布问题以堆叠溢出之前检查您的拼写!
相关文章:
- 将成员变量添加到共享库中的类中,不会破坏二进制兼容性吗
- 反向给定链表中的K节点
- 对RValue对象调用的LValue ref限定成员函数
- 为什么使用 "this" 指针调用派生成员函数?
- 具有奇怪重复模板模式的派生类中的成员变量已损坏
- 如果我只是不访问queue_front节点的子节点,而是将它们推到队列中呢?还是BFS吗
- 助记符和指向成员语法的指针
- 类成员函数无法访问同一类的私有结构节点?
- 类节点没有命名成员
- ROS:将回调函数和对象成员绑定到订阅节点
- 排序链表-移动节点还是交换数据成员
- 树类的节点出错,可能是因为专用节点成员
- 错误:请求"cur"中的成员"成员",该成员属于非类类型节点<int>* 二叉树
- C++删除成员函数中的临时节点
- 在树中找到一个节点,并用带有更新私有成员的新节点替换
- 链表节点结构的第一个成员变量总是下一个节点
- 在类LinkedList节点中访问结构体的成员
- 2-3-4树节点成员
- 类成员指向STL列表的特定节点成员
- 从指针到成员恢复父节点