In C++, how does using pointers and references work in as parameters in a function of a class? It is used a lot, and I dont really know how to use this as parameter in a function of a class, or in Polymorphism as well.
In C++, how does using pointers and references work in as parameters in a function of a class?
It is used a lot, and I dont really know how to use this as parameter in a function of a class, or in Polymorphism as well.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
C++ programming
Overview
This is a demonstration an ability to implement inheritance, composition, and overloaded operators in a program.
Pretend to be working in the IT department for a corporation and have been tasked with developing an application to manage assigning people to a team. This process involves creating a team with a name and a purpose, the assignment of people in the team, and the assignment of a person to lead the team.
Use inheritance to facilitate the reuse of code and operator overloading to allow the usage of familiar operators tailored specifically to the Person, TeamMember, and Leader classes. Composition is also demonstrated in using a Team class that contains objects of the TeamMember and Leader classes.
You will need to develop several classes to maintain this information:
Team, Person, TeamMember, Leader, and Date.
The characteristics of TeamMember and Leader are shown below:
TeamMember: Leader:
ID (string) ID (string)
First Name (string) First Name (string)
Last Name (string) Last Name (string)
Birthdate (Date) Birthdate (Date)
Department (string) Division (string)
Date hired (Date) Date promoted (Date)
Position (string) (i.e. Programmer, Writer, etc.) Title (string)
SkillLevel (string) (Entry Level, Skilled, Master) Last team lead (string)
Last performance rating (double) (1.0-5.0) Annual salary (double)
Strings will not be acceptable substitutes for date fields.
Person class (base class)
The Person class should contain data members that are common to both TeamMembers and Leaders in the above list.
Write appropriate member functions to store and retrieve information in the member variables above. Include constructors and destructors information as well.
TeamMember class and Leader class. (derived classes)
Both the TeamMember and Leader classes must be derived from the Person class.
Each must have the member variables shown above that are unique to each class. The data members that are common to both classes must be inherited from the Person class.
The constructor in the derived class must call the constructor in the base class correctly through the constructor definition.
Write member functions to store and retrieve information in the appropriate member variables. Be sure to include a constructor and destructor in each derived class.
In each derived class, the << operator should be overloaded to output, neatly formatted, all of the information associated with a team member or leader.
Team class
The Team class has a name data member (i.e. a Team’s name might be “Project ABC”).
The Team class has a purpose data member (i.e. a Team’s purpose might be “Feasibility study of project ABC”).
The class contains a Leader object that represents the employee assigned to lead the team.
The class contains a
The class has an integer variable, teamSize, that represents the number of team members the team needs.
The Team class supports operations to assign a leader to the team, assign team members to the team, and list all of the team information, including its name, purpose, leader, and team members assigned to it.
develop a function named sortTeamMembers() that uses the sort function to sort this vector. The sort function is part of the <algorithm> library.
You can put tokenizeDate in any class that you deem appropriate.
Main()
***write a main() function that begins by prompting the user for the name, purpose, and size of the team:
“T” should allow the user to develop a TeamMember record and assign the TeamMember to the Team. Unless team is full, then it should say “Team is full”
“A” should allow the user to develop a Leader record and assign the Leader member to the team as the leader.
“L” should list ALL of the team information, including the information about each TeamMember assigned to the team, (sorted by ID number), as well as all of the information about the Leader assigned to lead the team.
The user should be able to develop and assign only ONE Leader to the team but develop and assign as many TeamMembers to the team as the size allows.
“Q” should allow the user to exit the application.
Note: The user should be able to add repeatedly (until the team capacity is reached) and to list repeatedly until he or she selects “Q” to quit.
***For each TeamMember, the first name and last name are output on the same line, separated by a space.
***For the Leader, the format should be this: first name [space] last name [dash] title [dash] division