Click here to Skip to main content
15,559,725 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionProblem creating an array of "class" Pin
Roberto64_Ge6-Sep-22 11:25
Roberto64_Ge6-Sep-22 11:25 
SuggestionRe: Problem creating an array of "class" Pin
Mircea Neacsu6-Sep-22 11:38
Mircea Neacsu6-Sep-22 11:38 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge6-Sep-22 11:57
Roberto64_Ge6-Sep-22 11:57 
AnswerRe: Problem creating an array of "class" Pin
Richard MacCutchan7-Sep-22 6:10
mveRichard MacCutchan7-Sep-22 6:10 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 4:55
Roberto64_Ge8-Sep-22 4:55 
GeneralRe: Problem creating an array of "class" Pin
Greg Utas8-Sep-22 5:24
mveGreg Utas8-Sep-22 5:24 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 5:32
Roberto64_Ge8-Sep-22 5:32 
GeneralRe: Problem creating an array of "class" Pin
Greg Utas8-Sep-22 7:59
mveGreg Utas8-Sep-22 7:59 
Those lines have no effect because the default in C++ is to pass an argument by value. That is, to make a copy of it. If you want to modify the data that is passed to the function, it must be passed by reference; another option is to pass a pointer to the argument. To pass by reference, you append a & to the argument's type. So, you need to change your two small functions like this:
C++
void anagrafica::setNome(string& n_)
   {
   nome_cifrato=n_;
   }

void anagrafica::setCognome(string& c_)
   {
   cognome_cifrato=c_;
   }
Robust Services Core | Software Techniques for Lemmings | Articles
The fox knows many things, but the hedgehog knows one big thing.


modified 8-Sep-22 13:10pm.

GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan9-Sep-22 0:57
mveRichard MacCutchan9-Sep-22 0:57 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 5:32
mveRichard MacCutchan8-Sep-22 5:32 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 5:36
Roberto64_Ge8-Sep-22 5:36 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 5:53
mveRichard MacCutchan8-Sep-22 5:53 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 6:18
Roberto64_Ge8-Sep-22 6:18 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 6:25
mveRichard MacCutchan8-Sep-22 6:25 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 6:27
Roberto64_Ge8-Sep-22 6:27 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 6:17
mveRichard MacCutchan8-Sep-22 6:17 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 6:26
Roberto64_Ge8-Sep-22 6:26 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 6:38
mveRichard MacCutchan8-Sep-22 6:38 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 6:43
Roberto64_Ge8-Sep-22 6:43 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 6:37
Roberto64_Ge8-Sep-22 6:37 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 6:45
mveRichard MacCutchan8-Sep-22 6:45 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 9:04
Roberto64_Ge8-Sep-22 9:04 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan9-Sep-22 0:37
mveRichard MacCutchan9-Sep-22 0:37 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge9-Sep-22 11:30
Roberto64_Ge9-Sep-22 11:30 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan9-Sep-22 23:00
mveRichard MacCutchan9-Sep-22 23:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.