Код: Выделить всё
//
#include
template
class GenericTree {
private:
struct Node {
T data;
Node* LEFT;
Node* RIGHT;
Node(const T& value) : data(value), LEFT(nullptr), RIGHT(nullptr) {}
};
Node* root;
size_t count;
public:
GenericTree(const T& value) : root(new Node(value)), count(1) {}
Node* GetRoot() {
return root;
}
// Additional methods...
};
int main() {
GenericTree tree(1);
// This part is where I'm confused
std::cout data;
// etc.
return 0;
}
Вопросы:
Почему я могу получить доступ к ЛЕВОМ и ПРАВОМУ членам Node?
Каковы последствия определения Node как частного?
Будем очень признательны за любые разъяснения!< /п>
Подробнее здесь: https://stackoverflow.com/questions/791 ... of-class-i