【发布时间】:2015-01-12 11:05:33
【问题描述】:
我知道这个标题有点令人困惑,但图表可能会有所帮助。 在一个文件中:
#ifndef ...
#def ...
#includes (including OListiterator.h>
template <class T>
class OList;
template <class T>
Class OListiterator{
friend class OList<T>::OList;
typename OList<T>::Node* iiter;
};
function defs;
#endif
在另一个:
#ifndef ...
#def ...
#includes (one is OList.h)
template<class T>
class OListiterator;
template <class T>
Class OList{
friend class OListiterator<T>::OListiterator;
public:
class Node{
};
//things
};
//functions
#endif
这是我自己和协助我的 TA 认为可行的,但我被抛出错误:节点没有在 OList 中命名类型。有人知道为什么/如何解决这个问题吗?如果我需要发布更多内容,请告诉我。
【问题讨论】: