Can a c++ class include itself as an member?

No, because the object would be infinitely large (because every Node has as members two other Node objects, which each have as members two other Node objects, which each… well, you get the point).

You can, however, have a pointer to the class type as a member variable:

class Node {
    char *cargo;
    Node* left;   // I'm not a Node; I'm just a pointer to a Node
    Node* right;  // Same here
};

Leave a Comment