我在从 BSTree 中的泛型类型对象返回 null 时遇到问题
这是错误:System.exe 中出现“System.NullReferenceException”类型的第一次机会异常附加信息:对象引用未设置为对象的实例。如果有这个异常的处理程序,程序可以安全地继续
和我的代码
public BTree() //creates an empty tree
{
root.Name = default(T);
root.Members = default(T);
}
谢谢
我将 root 设置为:
public BST()
{
root = null;
}