You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
515 B

#include "person.h"
#include <iostream>
person::person(const char *_name, int by, int bm, int bd, int dy, int dm, int dd)
: birthday{by, bm, bd}, deathday{dy, dm, dd}
{
strcpy(name, _name);
std::cout << "创建了人类对象 " << name << '\n';
}
person::~person()
{
std::cout << "撤销了人类对象 " << name << '\n';
}
void person::print()
{
std::cout << "姓名:" << name << '\n';
std::cout << "生日:";
birthday.print();
std::cout << "忌日:";
deathday.print();
}