teacher.cpp

来自「交通系统中关于各地之间可行线程的求得」· C++ 代码 · 共 61 行

CPP
61
字号
// Teacher.cpp: implementation of the Teacher class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Teacher.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Teacher::Teacher(){}
Teacher::Teacher(string name,int number,int sex,int id,Birthday birthday)
{
	this->name  = name;
	this->number = number;
	this->sex = sex;
	this->id = id;
	this->birthday.year = birthday.year ;
	this->birthday .month = birthday .month ;
	this->birthday .day = birthday .day;
}

Teacher::~Teacher()
{

}

void Teacher::SetTeacherInfo(char	department[], char	principalship[])
{
	for(int i = 0;i<21;i++)
		this->principalship[i]= principalship[i];
	for(int n = 0;n<11;n++)
		this->department[n]= department[n];
}

Teacher Teacher::operator =( Teacher &teacher)
{	
	People::operator =(teacher);
	//this->SetTeacherInfo(teacher.department,teacher.principalship );
	for(int i = 0;i<21;i++)
		this->principalship[i]= teacher.principalship[i];
	for(int n = 0;n<11;n++)
		this->department[n]= teacher.department[n];
	return *this;
}

Teacher::Teacher(const Teacher &teacher){
	this->name  = teacher.name;
	this->number = teacher.number;
	this->sex = teacher.sex;
	this->id = teacher.id;
	this->birthday.year = teacher.birthday.year ;
	this->birthday .month = teacher.birthday .month ;
	this->birthday .day = teacher.birthday .day;	

	for(int i = 0;i<21;i++)
		this->principalship[i]= teacher.principalship[i];
	for(int n = 0;n<11;n++)
		this->department[n]= teacher.department[n];

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?