Copy and Overloading constructors

I figured this is the best place for this type of issue. I don't understand how to implement these functions into my program. I have everything else working the way I want it to. I'm a little lost and looking for some assistance/direction.

Here are the instructions for this program:

Implement the function printHighestToLowestVotes as follows:
 Create a map of integers and strings and copy all the total votes and correspondent first name and last name of each candidate. (The map will be in order by total votes.)

o The Big Three
 Since you have dynamic variables in your class, you should make sure that the big three are implements. You already have the destructor, but you will need to add a copy constructor and the overloaded assignment operator. This is simpler than it sounds, but it requires some thinking. You need to make sure that both the copy constructor and the assignment operator create new containers. To check this, you can either look in the debugger to see if the addresses are different, or you can create temporary functions to check that your copy constructor and overloaded assignment operator are doing what is expected.

Here is my header file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef CANDIDATELIST_H
#define CANDIDATELIST_H

#include "CandidateType.h"
#include <iostream>
#include <string>
#include <vector>
#include <map>

using namespace std;

class CandidateList
{
public:

	// Function declarations
	CandidateList();
	CandidateList(const CandidateList& other);
	CandidateList operator=(const CandidateList& other);
	void addCandidate(const CandidateType& newCandidate);
	int getWinner() const;
	void printCandidateName(int idNumber) const;
	void printAllCandidates() const;
	void printCandidateDivisionVotes(int idNumber, int division) const;
	void printCandidateTotalVotes(int idNumber) const;
	bool searchCandidate(int idNumber) const;
	void printHighestToLowestVotes() const;
	~CandidateList();
private:
	vector<CandidateType> *candidates;
	bool searchCandidateLocation(int ssn, vector<CandidateType>::const_iterator &iter) const;
};

#endif 


Here is the cpp file with the functions I'm working on:

1
2
3
4
5
6
7
8
9
10
11
12
13
CandidateList::CandidateList(const CandidateList& other) : candidates(new )
{

}

CandidateList CandidateList::operator=(const CandidateList& other)
{

}
void CandidateList::printHighestToLowestVotes() const
{
	map<int, string> person;
}


Am I headed in the right direction? Any help would be appreciated. Thank you.
Registered users can post here. Sign in or register to post.