#include<iostream>
using namespace std;
class Student
{
public://还有private、protected
char name[20];
int age;
char gender;
int print();
};
int main()
{
Student S;
Student &AS=S;
Student *p;
p = &S;
p->age = 20;
strcpy(p->name, "Jam");
p->gender = 'w';
p->print();
S.age = 20;
strcpy(S.name, "Jam");
S.gender = 'w';
S.print();
AS.age = 19;
strcpy(AS.name, "Snoopy");
AS.gender = 'm';
AS.print();
while (1);
return 0;
}
int Student::print()
{
cout <<"name:"<< name << endl;
cout << "age:" << age << endl;
cout << "gender:" << gender << endl;
return 0;
}