I'm coding my own Tree data structure. In my parent() function, I want to throw no_parent exception that I created. All functions are implemented in Tree.cpp file.
Tree.hpp
#ifndef Tree_hpp
#define Tree_hpp
#include <stdio.h>
#include <vector>
using namespace std;
template<typename T>
class Tree{
    class Node;
    class no_parent : public std::exception {
        virtual const char* what() const _NOEXCEPT
        {
            return "no_parent";
        }
    };
protected:
    Node* rootNode;
    Node* currentNode;
    int _size;
public:
    Tree();
    void addChild(T* childElem);
    void removeChild(int index) throw (out_of_range);
    bool empty();
    int size();
    Tree& root();
    bool isRoot();
    bool isExternal();
    Tree& parent() throw(no_parent);
    Tree& child(int index) throw(out_of_range);
    int getChildrenNum();
    int getChildrenNum(Node* node);
};
#endif /* Tree_hpp */
But when I implement no_parent in Tree.cpp file in this way
template<typename T>
class Tree<T>::no_parent : public std::exception {
    virtual const char* what() const _NOEXCEPT
    {
        return "no_parent";
    }
};
I get error message from parent() function "Incomplete type 'Tree::no_parent' is not allowed in exception specification". How can I implement the no_parent outside of Tree.hpp file??