首页 > 编程语言 > 详细

C++封装

时间:2020-02-17 12:36:10      阅读:68      评论:0      收藏:0      [点我收藏+]

#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;

}

C++封装

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!