I am interested in understanding exactly what the member access operator is referring to at the recursive function calls,this->addNode
. Thanks for any help in understanding what the function is being called on.
void BinarySearchTree::addNode(Node* node, Bid bid) {
// If node > bid, add to left subtree
if (node->bid.bidId.compare(bid.bidId) > 0) {
if (node->left == nullptr) {
node->left = new Node(bid);
}
// If left node exists, keep traversing down left subtree
else {
this->addNode(node->left, bid);
}
}
// If node < bid, add to right subtree
else {
if (node->right == nullptr) {
node->right = new Node(bid);
}
// If right node exists, keep traversing down right subtree
else {
this->addNode(node->right, bid);
}
}
}