|
|
|
|
#pragma once
|
|
|
|
|
#ifndef PERSON_H
|
|
|
|
|
#define PERSON_H
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <cstring>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include "date.h"
|
|
|
|
|
using namespace std;
|
|
|
|
|
#pragma warning(disable:4996)
|
|
|
|
|
class Person
|
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
char id[18];
|
|
|
|
|
char name[20];
|
|
|
|
|
char gender[6];
|
|
|
|
|
Date birthday;
|
|
|
|
|
public:
|
|
|
|
|
Person();
|
|
|
|
|
Person(char* sname, char* sid, char* sgender, int y, int m, int d);
|
|
|
|
|
~Person() {};
|
|
|
|
|
void setName(char* sname) { strcpy(name, sname); }
|
|
|
|
|
char* getName() { return name; }
|
|
|
|
|
void setId(char* sid) { strcpy(id, sid); }
|
|
|
|
|
char* getId() { return id; }
|
|
|
|
|
void setGender(char* sgender) { strcpy(gender, sgender); }
|
|
|
|
|
char* getGender() { return gender; }
|
|
|
|
|
void setBirthday(Date d) { birthday = d; }
|
|
|
|
|
Date getBirthday() { return birthday; }
|
|
|
|
|
virtual void inputData();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
virtual void displayDetails(); //<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
};
|
|
|
|
|
Person::Person() {//Ĭ<>Ϲ<EFBFBD><CFB9><EFBFBD>
|
|
|
|
|
strcpy(name, "null");
|
|
|
|
|
strcpy(gender, "<EFBFBD><EFBFBD>");
|
|
|
|
|
strcpy(id, "0");
|
|
|
|
|
birthday = Date(1980, 1, 1);
|
|
|
|
|
}
|
|
|
|
|
Person::Person(char* sname, char* sid, char* sgender, int y, int m, int d) {//
|
|
|
|
|
strcpy(name, sname);
|
|
|
|
|
strcpy(gender, sid);
|
|
|
|
|
strcpy(id, sgender);
|
|
|
|
|
}
|
|
|
|
|
void Person::inputData() {//<2F>Ļ<DEB8><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
cout << "name: "; cin >> name;
|
|
|
|
|
cout << "ID: "; cin >> id;
|
|
|
|
|
cout << "gender: "; cin >> gender;
|
|
|
|
|
cout << "birthday: " << endl; birthday.inputDate();
|
|
|
|
|
}
|
|
|
|
|
void Person::displayDetails() {//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
cout << "name: " << name << endl;
|
|
|
|
|
cout << "ID: " << id << endl;
|
|
|
|
|
cout << "gender: " << gender << endl;
|
|
|
|
|
cout << "birthday" << endl;
|
|
|
|
|
birthday.displayDate();
|
|
|
|
|
}
|
|
|
|
|
#endif //PERSON_H
|