Design the class doctorType, inherited from the class personType, with an additi
ID: 441535 • Letter: D
Question
Design the class doctorType, inherited from the class personType, with an additional data member to store doctors speciality. Add appropriate constructors and member functions to initialize, access, and manipulate the data members. Design the class patienttype , inherited from the class personType, with additional data members to store a patients Id, age, date of birth, attending physicians name, and the date the patient was discharged from the hospital. Use the class date type to store the date of birth, admit date, discharge date, and class doctorType, to store attending physicians name. Add appropriate constructors and member functions to initialize, access and manipulate the data members.Explanation / Answer
a) class personType { protected: String name; String address; public: void setName(String s) { this.name=s; } void setAddress(String address) { this.address = address; } public String getName() { return name; } public String getAddress() { return address; } }; // Derived class class doctorType: personType { protected String speciality; public: void setSpeciality(String spec) { this.speciality=spec; } String getSpeciality() { return speciality; } }; Similarly others can be found refer this http://www.tutorialspoint.com/cplusplus/cpp_inheritance.htm
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.