I have a template class for a tree. Now I want to make a class called TreeIterator that will just iterate through the tree and return a node. Is there a way to include and declare a Tree variable without making TreeIterator also a template? Or would the best option just be to make the iterator a nested class? The code below is what I want to do -
But this is what compiles -Code:#include "Tree.h" class TreeIterator { private: Tree tree; }; #endif
Any help is appreciatedCode:#ifndef TREEITERATOR_H #define TREEITERATOR_H #include "Tree.h" template<typename T> class TreeIterator { private: Tree<T> tree; }; #endif