I am after some guidance on how to solve my problem.
I've wrote some example code to try and help explain it:
As you can see, the program will be repeatedly asking the user for a person's name and then storing the details in a vector.
cout << "Menu options:" << endl;
cout << "1) Enter a new person" << endl;
cout << "2) Save and Exit" << endl;
cout << "Enter the person's name" << endl;
cin >> name;
Person *ptr = new Person(name);
v.push_back( *ptr );//Declaration == vector<Person*> v;
//Save all the Person objects to a text file for future use.
//Exit the program.
My confusion is what happens when more than one pointer/object is created.
The program will be trying to make a second pointer with the same name (ptr).
If the user goes onto create 10 people, that will be 10 *ptr's.
So I was wondering how this is normally handled.
I'm trying to hold all the Persons in the vector, so that they can be searched through, and once the user wishes to exit the program, save them all to a text file.
Thanks for any help, it's appreciated.