class 默认权限为私有
struct 默认权限为公共
示例代码:
#include <iostream>
using namespace std;
#include <string>
class Student
{
string name;
};
struct Teacher
{
string name;
};
int main()
{
Student s1;
// s1.name = "godv"; 报错访问不到
Teacher t1;
t1.name = "godv";
return 0;
}