SDUSTOJ2057 Problem D: 家教课程

您所在的位置:网站首页 主播都是穷人 SDUSTOJ2057 Problem D: 家教课程

SDUSTOJ2057 Problem D: 家教课程

2024-07-16 14:34:39| 来源: 网络整理| 查看: 265

Description

老师都是穷人,所以需要经常去外面搞点兼职啥的。可是除了上课,啥也不会啊。所以就只好做家教了。现在请利用面向对象的思想设计这样一个系统。具有如下类:

Person类:有一个string类型的属性,表明对象的名字。是Student和Teacher的父类。

Student类:是Person类的子类,拥有一个int类型的属性,表明对象的序号。

Teacher类:是Person类的子类,拥有一个string类型的属性,表明对象的职称。

Course类:是一个组合类,有1个Teacher类的对象、1个Student类型的对象,以及一个string类型的属性(表明对象的名称)组成。

请定义上述类的构造函数和析构函数,并在函数中输出相应的字符串。具体格式请参照样例输出。

Input

输入5行,前4个是4个字符串,分别是老师的名字、学生的名字、老师的职称、课程的名字。最后一行是一个整数,表示学生的序号。

Output

见样例~

Sample Input

Tom Jack Prof C++ 10

Sample Output

Person Tom is created. Person Jack is created. Person Tom is created. Teacher Tom with position Prof is created. Person Jack is created. Student Jack with id 10 is created. Person Jack is created. Teacher Jack with position Prof is created. Person Jack is created. Student Jack with id 10 is created. Course C++ is created. Course C++ is erased. Student Jack with id 10 is erased. Person Jack is erased. Teacher Jack with position Prof is erased. Person Jack is erased. Student Jack with id 10 is erased. Person Jack is erased. Teacher Tom with position Prof is erased. Person Tom is erased. Person Jack is erased. Person Tom is erased.

HINT

注意根据main函数分析各个构造函数的每个参数的含义。

Append Code

append.cc,

标程 #include using namespace std; class Person { protected: string name; public: Person(string nn):name(nn) {cout protected: string pos; public: Teacher(string nn, string p):pos(p), Person(nn) {cout protected: int num; public: Student(string nn, int i):num(i), Person(nn) {cout private: string cour; Teacher t; Student s; public: Course(string s1, string s2, string s3, string s4, int id): s(s2, id), t(s2, s3), cour(s4){ cout string s1, s2, s3, s4; int i; cin>>s1>>s2>>s3>>s4>>i; Person person1(s1), person2(s2); Teacher teacher(s1, s3); Student student(s2, i); Course course(s1, s2, s3, s4, i); return 0; }


【本文地址】

公司简介

联系我们

今日新闻


点击排行

实验室常用的仪器、试剂和
说到实验室常用到的东西,主要就分为仪器、试剂和耗
不用再找了,全球10大实验
01、赛默飞世尔科技(热电)Thermo Fisher Scientif
三代水柜的量产巅峰T-72坦
作者:寞寒最近,西边闹腾挺大,本来小寞以为忙完这
通风柜跟实验室通风系统有
说到通风柜跟实验室通风,不少人都纠结二者到底是不
集消毒杀菌、烘干收纳为一
厨房是家里细菌较多的地方,潮湿的环境、没有完全密
实验室设备之全钢实验台如
全钢实验台是实验室家具中较为重要的家具之一,很多

推荐新闻


图片新闻

实验室药品柜的特性有哪些
实验室药品柜是实验室家具的重要组成部分之一,主要
小学科学实验中有哪些教学
计算机 计算器 一般 打孔器 打气筒 仪器车 显微镜
实验室各种仪器原理动图讲
1.紫外分光光谱UV分析原理:吸收紫外光能量,引起分
高中化学常见仪器及实验装
1、可加热仪器:2、计量仪器:(1)仪器A的名称:量
微生物操作主要设备和器具
今天盘点一下微生物操作主要设备和器具,别嫌我啰嗦
浅谈通风柜使用基本常识
 众所周知,通风柜功能中最主要的就是排气功能。在

专题文章

    CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭