I am in my 3rd consecutive computer class in college and I still am struggling immensely in understanding why, when and how to use the operators *, &, and ->. Currently I am working on using Insertion, Merge and Quick sorts to analyze the time differences to sort massive amounts of data. But I am having trouble accessing the vector in the header file.
class CensusData {
public:
staticconstint POPULATION = 0; // type of sort
staticconstint NAME = 1;
~CensusData();
void initialize(ifstream&); // reads in data
int getSize(){return data.size();}
void print(); // prints out data
void insertionSort(int); // sorts data using insertionSort
void mergeSort(int); // sorts data using mergeSort
void quickSort(int); // sorts data using quickSort
private:
class Record { // declaration of a Record
public:
string* city;
string* state;
int population;
Record(string&, string&, int);
~Record();
};
vector<Record*> data; // data storage
//
// Insert private helper functions here
//
};
* Asterisk is used for Dereferencing a pointer.. means accessing the value or data a pointer is pointing to.. similarly for -> means the same but like we do Student.Roll_no in a class of student to access the Roll_no in same way we use -> to access the pointer member of any class