Ciao.
Devo poter recuperare o settare il valore di un dato.
E devo poterlo fare con l'indice intero o con l'indice stringa ma vorrei mantenere una sola mappa che contiene i valori.
gli indici non sono consecutivi.
ho pensato:
codice:
//indici
mapIndexInt[0]="indice0";
mapIndexInt[5]="indice1";
//valori
mapValue["indice0"]="aaaaaaa"
mapValue["indice1"]="bbbbbb"
mapValue["indice2"]="ccccccc"
void setValue0ConInt(string value){
string strIndice= mapIndexInt[0];//la funzione si chiama setValue0....= 0
mapValue[strIndice] = value;
};
void setValue0ConText(string value){
mapValue["indice0"] = value;//la funzione si chiama setValue0 ... = 0
}
string getValue0ConInt(){
string strIndice= mapIndexInt[0];//v.sopra = 0
return mapValue[strindice];
}
string getValue0ConText(){
return mapValue["indice0"]//v sopra =0 = indice0
}
E' sbagliato come metodo?
voi come lo fareste?
Grazie.