Suppose, we have two related (child) classes named Doctor and Patient. Data members required by each class are given below. data members of doctors name type remarks name sring full name of the person age int age of the person spec string specialization of the doctor   data members of patient. name type  remarks name string full name of the person age int age of the person diag string diagnosed problem Using the information given above, create the following three classes. a. A parent class named Person containing common data members and functionality of the child classes; Doctor and Patient b. The class Doctor which is publicly inherited from the class Person c. The class Patient which is publicly inherited from the class Person Each class must contain at least two constructors in addition to the appropriate set() and show() functions. Functions of child classes should call appropriate functions of the parent class to perform the common functionality. All the function definitions should be written inside the class. Also provide a suitable main function to demonstrate the creation and usage of different objects of child classes.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 12PE
icon
Related questions
Question

Suppose, we have two related (child) classes named Doctor and Patient. Data members
required by each class are given below.

data members of doctors

name type remarks
name sring full name of the person
age int age of the person
spec string specialization of the doctor

 

data members of patient.

name type  remarks
name string full name of the person
age int age of the person
diag string diagnosed problem

Using the information given above, create the following three classes.


a. A parent class named Person containing common data members and functionality of
the child classes; Doctor and Patient
b. The class Doctor which is publicly inherited from the class Person
c. The class Patient which is publicly inherited from the class Person


Each class must contain at least two constructors in addition to the appropriate set() and show() functions. Functions of child classes should call appropriate functions of the parent class to perform the common functionality. All the function definitions should be written inside the class. Also provide a suitable main function to demonstrate the creation and
usage of different objects of child classes.

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Software Development
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr