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;

}

原文地址:https://www.cnblogs.com/blck/p/12320790.html