Code logic height function

in the code how is the height calculated without any function of height
ht = max(left,right)+1
class HBPair{
public:
int height;
bool balance;

};
HBPair isheightbalanced(node*root){
HBPair p;
if(root== nullptr){
p.height = 0;
p.balance = true;
return p;
}
//recursive
HBPair left = isheightbalanced(root->left);
HBPair right = isheightbalanced(root->right);
if(abs(left.height - right.height)<= 1 && left.balance && right.balance){
p.balance = true;
}else{
p.balance = false;
}
return p;
}