具有结构或类的链表实现?

2 c++ data-structures singly-linked-list

我开始使用 C++ 中的数据结构,在阅读时,我想到了以下代码段,

template <class Node_entry>
struct Node {
// data members
Node_entry entry;
Node<Node_entry> *next;
// constructors
Node( );
Node(Node_entry, Node<Node_entry> *link = NULL);
};
Run Code Online (Sandbox Code Playgroud)

任何人都可以详细说明为什么作者选择结构而不是类来实现singly linked list? 谢谢。

Nem*_*vic 5

他希望默认访问是公开的——这是 C++ 中类和结构之间的唯一区别