基础编码
template<typename T>
class Node
{
private:
T m_value;
Node<T> *m_right_child;
Node<T> *m_left_child;
public:
~Node(){delete m_right_child;
delete m_left_child; }
Node():m_value(0),m_right_child(nullptr),m_left_child(nullptr){}
Node(const Node<T> &nd);
int get_Value(){return m_value};
void set_Value(T value){ m_value = value;}
Node * get_Right_Child();
void set_Right_Child(Node<T> & nd);
};
首先,私有指针成员变量以及形参类型,需要带有T;
需要析构函数。

浙公网安备 33010602011771号