当前位置:网站首页>Week 12 - task 2- shoulder to shoulder cadres
Week 12 - task 2- shoulder to shoulder cadres
2022-06-29 05:46:00 【sxhelijian】
【 subject 】( The teaching material P394 exercises 9) Defining the Teacher( Teachers' ) Classes and Cadre( Cadres ) class , A new class is derived from these two classes by means of multiple inheritance Teacher_Cadre( Teachers and cadres ). requirement :
(1) Include names in both base classes 、 Age 、 Gender 、 Address 、 Telephone and other data members .
(2) stay Teacher Class also contains data members title( The title ), stay Cadre Class also contains data members post( position ), stay Teacher_Cadre Class also contains data members wages( Wages ).
(3) For names in two base classes 、 Age 、 Gender 、 Address 、 Telephone and other data members use the same name , When referring to these data members , Specify scope .
(4) Declare member functions in the body of the class , Define member functions outside the class .
(5) In derived classes Teacher_Cadre Member function of show Call in Teacher Class display function , Export name 、 Age 、 Gender 、 The title 、 Address 、 Telephone , And then use cout Statement output job and salary .
( In some universities , Teachers with administrative positions , be called “ Shoulder to shoulder ”. I did , I can't pick , I dropped one end , It's what it is now .)
【 analysis 】 The key to this problem is to have data members with the same name in two base classes , The ambiguity caused by multiple inheritance arises . In a derived class , Need to pass through “ Class name :: Member name " Form solution . This is one way to solve this kind of problem .
【 Reference code 】
边栏推荐
- 2022 recommended RCEP regional comprehensive economic partnership agreement market quotation Investment Analysis Industry Research Report (the attachment is a link to the online disk, and the report i
- Testing grpc service with grpcui
- [high concurrency] deeply analyze the callable interface
- 2022 recommended REITs Industry Research Report investment strategy industry development prospect market analysis (the attachment is a link to the online disk, and the report is continuously updated)
- Problems with MySQL database query
- Research Report on the recommended lithography industry in 2022 industry development prospect market investment analysis (the attachment is a link to the network disk, and the report is continuously u
- Analysis report on the investment market of the development planning prospect of the recommended wind power industry research industry in 2022 (the attachment is a link to the network disk, and the re
- Common optimization items
- PCI Verilog IP
- Review of MySQL knowledge points
猜你喜欢

Analysis report on the investment market of the development planning prospect of the recommended rare earth industry research industry in 2022 (the attachment is a link to the online disk, and the rep

Robot reinforcement learning - transferring end-to-end videomotor control from simulation to realworld (curl 2017)

Notebook access desktop shared disk

Summary of redis basic knowledge points

开启生态新姿势 | 使用 WordPress 远程附件存储到 COS

51 single chip microcomputer learning notes 7 -- Ultrasonic Ranging

Openfpga wishes you a happy Lantern Festival!

2022 community group buying industry research industry development planning prospect investment market analysis report (the attachment is the online disk link, and the report is continuously updated)

Open a new ecological posture | use WordPress remote attachment to store to Cos

Rich material libraries make modeling easy and efficient for developers
随机推荐
Direct derivation of Bessel function with MATLAB
2022 recommended precious metal industry research report industry development prospect market analysis white paper (the attachment is a link to the online disk, and the report is continuously updated)
Love that can't be met -- what is the intimate relationship maintained by video chat
real time AI based system questionaires
RTOS embarqués
Use VS to create a static link library Lib and use
2022 community group buying industry research industry development planning prospect investment market analysis report (the attachment is the online disk link, and the report is continuously updated)
Ghost in the Log4Shell
Research Report on the new energy industry of recommended power equipment in 2022 industry development prospect market investment analysis (the attachment is a link to the network disk, and the report
5000+ word interpretation | Product Manager: how to do a good job in component selection?
CCTV revealed that xumengtao won the black Technology: there was a virtual coach???
Boost the digital economy and face the future office | the launch of the new version of spreadjsv15.0 is about to begin
[chromium] win10 vs2019 environment chromium configuration and compilation.
【IoT】公众号“简一商业”更名为“产品人卫朋”说明
3 frequently tested SQL data analysis questions (including data and code)
Rich material libraries make modeling easy and efficient for developers
How to hand over complex legacy systems?
The first in China! CICA technology database antdb appears at the performance test tool conference of China Academy of communications technology
Robot reinforcement learning -- first person vs third person
(practice C language every day) matrix