C++课后习题4.21
来源:互联网 发布:淘宝天猫商城转让 编辑:程序博客网 时间:2024/05/20 02:51
#include <iostream>#include <string>using namespace std;class Time{public: Time(int h,int m,int s) { hours=h; minutes=m; seconds=s; } void display() { cout<<"BIRTH TIME:"<<hours<<"hour"<<minutes<<"minutes"<<seconds<<"second"<<endl; }protected: int hours; int minutes; int seconds;};class Date{public: Date(int m,int d,int y) { month=m; day=d; year=y; } void display() { cout<<"出生时间"<<month<<"month"<<day<<"day"<<year<<"year"<<endl; }protected: int month,day,year;};class Birthtime:public Time,public Date{public: Birthtime(int h,int m,int s,int mo,int d,int y,string name):Time(h,m,s),Date(mo,d,y) { childname=name; } void display1() { Time::display(); } void display2() { Date::display(); } void display() { cout<<childname<<endl; }protected: string childname;};int main(){ Birthtime A(1,1,1,1997,9,6,"Belle Chou");A.display1();A.display2();A.display();}
0 0
- c程序设计语言 课后习题
- C++课后习题4.21
- C和指针课后习题
- C语言课后习题解
- C++Primer Chapter3课后习题
- C程序设计谭浩强版课后习题答案
- 《C语言程序设计教程》课后习题答案
- c程序设计课后习题p39 2.27
- C语言程序设计 全书课后习题答案!!
- 《C Primer Plus》第一章 概览 课后习题
- C语言第三版课后习题答案
- 数据结构(C语言版)课后习题1.3
- 数据结构(C语言版)课后习题1.4
- 数据结构(C语言版)课后习题2.1
- Linux&C 线程控制 课后习题
- c primer plus第十一章课后习题
- linux&c 进程控制 课后习题
- c程序设计(4)函数课后习题
- 虚函数
- 正则表达式 详解
- android圆角图片
- 项目代码风格要求
- 《机器学习实战》K近邻(KNN)分类
- C++课后习题4.21
- [课堂笔记]二.Java语法基础
- Android 中ListView带复选框多选、全选、不选处理
- 上传base64格式的图片
- 第三章 练习 知识点 课后作业
- SpringBoot项目实战--Jetty
- Python GUI (一)
- Python3 基础:单元测试
- 第四章的小知识点