이진 검색 트리로 작업하고 있습니다. 여기 트리에서 항목을 삭제하는 함수를 작성하고 있습니다. 다음 코드에서 :복사 생성자
if(root = NULL)//if there is nothing in the tree
{
cout<<"the Tree is empty"<<endl;//ouput to the screen
return;//exit the function
}
bool isFound = false;//tells us if the item is found
Node* tmp = new Node();//declare a temp pointer
Node* tmp2 = new Node();;//declare a temp pointer
tmp* = *root;//assign the pointer to something
그것은 복사 생성자를 호출,하지만 난이 그것을 지금 난 그냥이 같은 값을 복사 해요 :에, 당신은 포인터를 할당하고
Node& Node::operator= (const Node& node)
{
data = node.data;
left = node.left;
right = node.right;
return *this;
}
실제 질문은 무엇입니까? – Michael