结构

可与 class 互换 ,但以下区别除外:

  • 如果使用关键字 struct 定义类类型,则 base 和 member 的默认可访问性是 public 而不是 private。
  • struct 不能用于声明模板类型参数或模板模板参数; 只有 class 才可以。