C++封装

#include <iostream>
#include <string>

using namespace std;

class studenClass
{
private:
string strName;
string strClass;
int number;
string homeAddress;
int chinese;
int math;
int english;



public:
string getstrName(){return strName};
string gethomeAddress(){return homeAddress};
};

int main()
{
studenClass student[30];
student[0].strName="tom";
student[0].strClass="class 2";
student[0].number=12324;
student[0].homeAddress="beijing road";
student[0].chinese=98;
student[0].math=77;
student[0].english=99;

}

posted @ 2020-02-17 10:58  blck  阅读(117)  评论(0编辑  收藏  举报