目前,Im公司有一个项目,是我用千名名字的硬拷贝文档,并将其植入双双管储存树。 Hit error 脚石
error C2248: std::basic_ios<_Elem,_Traits>::basic_ios : cannot access private member declared in class std::basic_ios<_Elem,_Traits> c:program files (x86)microsoft visual studio 10.0vcincludefstream 1116
我希望有人能够帮助我解释问题的根源。
预先感谢。
jo
edit:
BinaryTreeStorage::BinaryTreeStorage(void) : root(NULL)
{
}
BinaryTreeStorage::~BinaryTreeStorage(void)
{
}
void BinaryTreeStorage::insert(string &input, TreeNode *&root)
{
if(root != NULL)
{
root -> name = input;
root -> left = NULL;
root -> right = NULL;
}
else if (input < root -> name)
{
insert(input, root -> left);
}
else
{
insert(input, root -> left);
}
}
string BinaryTreeStorage:: writeToTree(TreeNode *&root)
{
if(root ->left != NULL)
{
writeToTree(root ->left);
}
return root->name;
if (root->right != NULL)
{
writeToTree(root);
}
}
void BinaryTreeStorage::write(ofstream nameOut)
{
cout << "Writing out bst names" << endl;
writeToTree(root);
}
void BinaryTreeStorage::read(ifstream& nameIn)
{
cout<< "Reading in bst" << endl;
string name;
for (int i = 0; i < numberOfNames; i++)
{
nameIn >> name;
insert (name, root);
}
}