Because a type must be declared before it can be used. Right now binaryTreeType
is declared after it's used in PostorderTreeEnumerator
. You can fix this by adding a forward declaration for binaryTreeType
.
template<typename elemType>
class binaryTreeType;
template<class elemType>
class PostorderTreeEnumerator
{
public:
PostorderTreeEnumerator(const binaryTreeType<elemType> *&otherTree);
// ... rest of PostorderTreeEnumerator ...
};