已采纳回答 / li_yuting
一个类(class)里面的各种变量是数据成员,类里面的函数是成员函数class student{public:string name;int age;void shuchu(){cout<<name<<age<<endl;}}比如 student 类里面,string name 和 int age 是数据成员, shuchu 就是成员函数
2016-05-05
class studnet{
public:
string name;
int age;
}
int main()
{
student st;
st.name="慕容网";
st.age=100;
cout<<"name is"<<+st->name<<endl<<"age is"<<st->age<<endl;
delete st;
st=NULL;
system("pause");
return 0;
}
public:
string name;
int age;
}
int main()
{
student st;
st.name="慕容网";
st.age=100;
cout<<"name is"<<+st->name<<endl<<"age is"<<st->age<<endl;
delete st;
st=NULL;
system("pause");
return 0;
}