#include #include "employee.h" Employee::Employee() { this->individualEmpNo = 0; this->grade = 0; this->accumPay = 0; } Employee::Employee(int no, int newGrade, int newAccumPay) { this->individualEmpNo = no; this->grade = newGrade; this->accumPay = newAccumPay; } Employee::~Employee() { std::cout << "欢迎使用,再见" << std::endl; } void Employee::printInfo() { std::cout << "Employee No. " << this->individualEmpNo << ": grade " << this->grade << ", accumPay: " << this->accumPay << std::endl; } void Employee::setEmpNo(int newNo) { this->individualEmpNo = newNo; } void Employee::setGrade(int newGrade) { this->grade = newGrade; } void Employee::setAccumPay(int newAccumPay) { this->accumPay = newAccumPay; } int main() { Employee* staff[4]; staff[0] = new Employee(); staff[1] = new Employee(11343, 2, 2000); staff[2] = new Employee(199, 1, 4000); staff[3] = new Employee(59949, 4, 400); for (int i = 0; i < 4; i++) { staff[i]->printInfo(); } delete staff[3]; return 0; }