C++面向对象程序设计教程(第3版)—-陈维兴,林小茶课后习题答案 下载本文

.

public:

Birthtime(char name[], int m, int d, int y, int h, int mi, int s): Time(h, mi, s), Date(m, d, y) {

strcpy(Childname, name); }

void showName() {

cout << \我的名字是: \ << Childname << endl; } private:

char Childname[25]; }; int main() {

Birthtime b(\, 3, 6, 2012, 11, 12, 42); b.showName(); b.Time::display(); b.Date::display(); return 0; }

精选范本

.

4.22

#include using namespace std; #include

class person { protected:

char number[25]; char name[25]; public:

person(char num[], char na[]) {

strcpy(number, num); strcpy(name, na); }

void showName() {

cout << \编号:\ << number << \姓名:\ << name; }

精选范本