编写一个标准类—Student
来源:互联网 发布:vue.js 2.0 分页插件 编辑:程序博客网 时间:2024/06/09 15:28
编写一个标准类—Student
Main函数:
#include <iostream>#include <string>#include "Student.h"using namespace std;int main(){Student student("xiaoming", "123");student.display();student.set_pass_word("456");cout << student.get_pass_word();return 0;}
头文件:
#include <string>using namespace std;class Student{private:string user_name;string pass_word;public:Student(string user_name, string pass_word);string get_user_name();string get_pass_word();void set_user_name(string user_name);void set_pass_word(string pass_word);void display();};
源文件:
#include <string>#include <iostream>#include "student.h"using namespace std;Student::Student(string user_name, string pass_word){this->user_name = user_name;this->pass_word = pass_word;}string Student::get_user_name(){return this->user_name;}string Student::get_pass_word(){return this->pass_word;}void Student::set_user_name(string user_name){this->user_name = user_name;}void Student::set_pass_word(string pass_word){this->pass_word = pass_word;}void Student::display(){cout << "user_name: " << this->user_name << endl;cout << "pass_word: " << this->pass_word << endl;}
- 编写一个标准类—Student
- 编写一个代表学生的Student类
- 编写一个标准类—Box
- (小练习)编写一个Student类,代表学生
- 一个Student类
- 创建一个类Student
- 编写一个异常类MyException,再编写一个类Student,该类有一个产生异常的方法oid speak(
- 设计一个学生类Student
- 设计一个学生类Student
- 编写程序STUDENT *Create(STUDENT studs[],int n)。 STUDENT是一个结构类型,包含姓名、成绩和指针域。
- 编写一个标准strcpy函数
- 编写一个标准strlen函数
- 编写一个Student类:该类拥有属性:校名,学号,性别,出生日期。方法包涵设置姓名和成绩
- JAVA - 一个简单的Student类
- 【作业】用c++定义一个student类
- 编写一个异常类MyException,再编写一个类Student,该类有一个产生异常的方法public void speak(int m) throws MyException,要求参数m的值大于1000时,方法抛出一个MyException对象。最后编写
- 一个标准的自定义适配器的编写
- T0603——建立一个人类(Person)和学生类(Student)
- 硬链接和软链接的区别
- 梦想在左,现实向右
- Android自定义捕获Application全局异常
- 动态规划 矩阵链乘法
- Android自定义捕获Application全局异常优化版
- 编写一个标准类—Student
- 在ubunut中安装了opencv2.1之后,自己编写程序, 出现undefined reference to `cvLoadImage'
- Objective-C的self.用法的一些总结
- 二倍压缩素数筛法
- Java已死?九百万程序员说不
- 编写一个标准类—Box
- Fzu 1607 Greedy division
- 在direct 3d中实现shadow map的步骤
- How to become a Responsible Individual