How do I use "this" in a member function?
- by Peter Stewart
I've written a member function of class Node to read a tree of Nodes in postfix order.
It will be called by the Node instance which is the root node of the tree.
So: N.postfix();
these appear to be illeagal:
*this->left.postfix();
*this->right.postfix();
What is the proper way to do this?
class Node
{
public:
const char *cargo;
int depth;
Node *left;
Node *right
void Node::postfix()
{
if (this==__nullptr)
{
return;
}
else
{
*this->left.postfix();
*this->right.postfix();
out<<*this->cargo<<"\n";
return;
}
};