parent
fa17fe42a5
commit
e6a15d0114
@ -0,0 +1,21 @@
|
|||||||
|
#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();
|
||||||
|
}
|
Loading…
Reference in new issue