Click here to Skip to main content
15,879,535 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Problem creating an array of "class" Pin
Greg Utas8-Sep-22 4:24
professionalGreg Utas8-Sep-22 4:24 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 4:32
Roberto64_Ge8-Sep-22 4:32 
GeneralRe: Problem creating an array of "class" Pin
Greg Utas8-Sep-22 6:59
professionalGreg Utas8-Sep-22 6:59 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 23:57
mveRichard MacCutchan8-Sep-22 23:57 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 4:32
mveRichard MacCutchan8-Sep-22 4:32 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 4:36
Roberto64_Ge8-Sep-22 4:36 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 4:53
mveRichard MacCutchan8-Sep-22 4:53 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 5:18
Roberto64_Ge8-Sep-22 5:18 
i do not know how to quote a previous answer. Anyway you suggested me to use a pointer to an array of pointers so we did

anagrafica **Arr_ = new anagrafica*[N];

But in this case compiler didn't let me access the method in this way :

Arr_[i].setChiave(3);

For that reason I asked for the correct syntax. Meanwhile I was waiting your reply I decided to try and so I went back to the first version temporarily and this is working, with respect to my first question " why I cannot see all the array elements?".
With this I mean that, also with my first version, if I access Arr_[i] during the debug (within the relevant window "Control expression". I guess this is the correct translation from Italian) I see all the different instances of the class in each element of the array Arr_. I attach here the code of the first version.

With this version running then I get a new malfunction that is that when I call the method for cifrating the true name and surname, from within this method I call the two methods to set the name and the surname, setNome and setCognome but this has no effects. If preferred I will attach the complete solution.
C++
<pre>anagrafica* Arr_ = new anagrafica[N];

for (int i = 0; i < N; i++)
{
	Arr_[i] = anagrafica("ciao", "miao", i*25);
}

for (int i=0; i<N; i++)
{
 file>>chiave;
 file>>n;
 file>>c;
 Arr_[i].setChiave(chiave);
 cod(Arr_[i],n,c,chiave);
}
for (int i=0; i<N; i++)
	Arr_[i].stampa();

GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 5:25
mveRichard MacCutchan8-Sep-22 5:25 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 5:27
Roberto64_Ge8-Sep-22 5:27 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 5:17
mveRichard MacCutchan8-Sep-22 5:17 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 5:26
Roberto64_Ge8-Sep-22 5:26 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 5:38
mveRichard MacCutchan8-Sep-22 5:38 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 5:43
Roberto64_Ge8-Sep-22 5:43 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 5:37
Roberto64_Ge8-Sep-22 5:37 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 5:45
mveRichard MacCutchan8-Sep-22 5:45 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 8:04
Roberto64_Ge8-Sep-22 8:04 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 23:37
mveRichard MacCutchan8-Sep-22 23:37 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge9-Sep-22 10:30
Roberto64_Ge9-Sep-22 10:30 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan9-Sep-22 22:00
mveRichard MacCutchan9-Sep-22 22:00 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge10-Sep-22 0:34
Roberto64_Ge10-Sep-22 0:34 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan10-Sep-22 0:47
mveRichard MacCutchan10-Sep-22 0:47 
QuestionHow can do it in c++? Pin
Member 157580955-Sep-22 6:07
Member 157580955-Sep-22 6:07 
GeneralRe: How can do it in c++? Pin
Richard MacCutchan5-Sep-22 6:43
mveRichard MacCutchan5-Sep-22 6:43 
AnswerRe: How can do it in c++? Pin
Greg Utas5-Sep-22 6:44
professionalGreg Utas5-Sep-22 6:44 

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.