hi, first of all, thanks for your response: the iterator part is awesome for me now, because the fact that is pointing at the data and it's not the data itself, it's kinda obvious but i didn't realize that hours ago.
i need a map because:
in the first field, i have an integer reference. and i need to store that.
in the second field, i have an object called "Persona". (name and last name).
but i need to store a lot of objects and, afterwards, i'll have to modify that objects accessing through the reference.
This is my Class Persona code:
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
|
class Persona {
private:
string nombre, apellido;
public:
Persona() {}
~Persona() {}
//SETERS
void setNombre(string nombre) {
this->nombre = nombre;
}
void setApellido(string apellido) {
this->apellido = apellido;
}
void setPersona() {
cout << "\nNombre: ";
getline(cin, nombre);
cout << "Apellido: ";
getline(cin, apellido);
cout << endl;
}
//GETERS
string getNombre() {
return nombre;
}
string getApellido() {
return apellido;
}
void getPersona() {
cout << "\nNombre: " << nombre;
cout << "\nApellido: " << apellido;
}
};
|
and the reason i need a map, it's because the file i'm intended to write, it's like an agenda (with names, last names and phones).
in other part of my code (in another project, because this part won't budge) i have an index, with 2 fields:
map <int,int> index;
first field: phone number;
second field: reference number;
so, the reference here (second field) is the same reference i use in the first field of my function void Ingresar().
and then, if i want to access at some data in the file, i only need the reference.
maybe it's nonsense, and i know it might be. plus, my english is very sad.
sorry for the lame explanation and i understand if you can't help me anymore.
thanks!