Copy constructor and Operator overloading

I don't really understand how to implement these functions. I have everything else working but these. Here are the instructions for this project:

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
35
36
37
38
39
40
41
42
43
  /*
Daniel Williams
CS A250
October 24, 2014

Project 2 Part B
*/

#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


and here is my 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;
}


I'm not sure where to even start or if I'm even headed in the right direction. Any assistance would be appreciated. Thank you.
Topic archived. No new replies allowed.