Call a method of a class from a function within the class itself? C ++

0

I created the "checkCase4" function in my Tree class and inside it I call 2 methods of the class itself (rotate_left and rotate_right).

Function:

void checkCase4(Node *child, Node *grand) {
 if (child == child->parent->right && child->parent == grand->left) {
  rotate_left(grand, child->parent, child);
  child = child->left;
 }
 else if (child == child->parent->left && child->parent == grand->right) {
  rotate_right(grand, child->parent, child);
  child = child->right;
 }
 checkCase5(child, child->parent->parent);
}

Method:

void Tree::rotate_right(Node *gr, Node *par, Node *ch){
...
}

And I get the following error:

rbt.cpp: In function 'void checkCase4 (Node *, Node *)':
: 32: 44: rbt.cpp: 32: 44: 'rotate_left' was not declared in this scope
     rotate_left (grand, child-> parent, child);

rbt.cpp: 36: 45: error: 'rotate_right' was not declared in this scope
     rotate_right (grand, child-> parent, child);

If anyone can help me, I would appreciate it.

    
asked by anonymous 18.11.2017 / 18:39

0 answers