class student {
//不写权限默认为私有的 private
int id;
char name[16];
int age;
int sex;
public:
int grade;
int class;
protect:
int aihao;
public:
void sayhello{
printf("hello");
};
void sayhello2(); //可以把声明写再类内,实现写在外部
}; //要以分号结尾
student类sayhello2的实现
void student::sayhello2(){
printf("hello2");
};
student xiaoming;
xiaoimng.sayhello();