Question
************ Hello I am having trouble with my code. In this code I define four classes named Person, Employee, Student, Professor, and Secratary. I have
************ Hello I am having trouble with my code. In this code I define four classes named Person, Employee, Student, Professor, and Secratary. I have to preform inheritance having to inherit from Person, and the Employee class. My code is displaying some errors that I cant seem to correct. I feel the problem is from the way I define my constructors. my code, list of errors, and a copy of the task is going to be below, feel free to modify the classes as much as you need. Thank you in advance.************************
*
*
*
//a copy of the task
*
*
*
//my code so far
#include #include #include
using namespace std;
class Person { private: string name; string ssn; public: Person(): name(""), ssn("") { } Person(string n, string ss): name(n), ssn(ss) { } string get_name() { return name; } string get_ssn() { return ssn; } void set_name(string n) { name=n; } void set_ssn(string n) { ssn=n; } virtual void print() { cout
main() { vector persons;
persons.push_back(new Person("Dave")); persons.push_back(new Person("Jack", "123-45-6789")); persons.push_back(new Employee("Sam", "111-22-3333", 50'000)); persons.push_back(new Professor("Kay", "444-33-2222", 70'000, "Parallel Computing")); persons.push_back(new Professor("Joy", "555-55-5555", 1'000, "AI")); persons.push_back(new Secretary("Misty", "999-99-9999", 900'000)); persons.push_back(new Student("Ace Prog", "654-32-3456", "B"));
for (int i = 0; i print();
for (int i = 0; i
*
*
*
//list of errors
CSE 202 X D CSE 202 Lab 5 x C Chagg Study Guided so X Bias - ? c cse.csust.edu/kay/ew202/ @AUDI Apps | YouTube CAS - California Sta: 4 Online C + Compila Amazon.com: Online f Facebook Design class Person with private fields name and social security number, and a public virtual member function print(). Derive classes Employee and student from Person. An employee has a private field salary and a student has a private field grade in addition to the data fields in person. Derive classes Professor and secretary from Employee. A professor has a private field research area and a secretary has a private field department he/she works for in addition to the data fields in employee. Every class has to have a print() function to print its own data fields and those of its base class. Make sure the following main() function works correctly with your classes. main() vectorStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started