Click here to Skip to main content
16,004,882 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How can I run the other program from my console program? Pin
otakung17-May-05 15:24
otakung17-May-05 15:24 
QuestionVC++ certifications??? Pin
mandanani16-May-05 23:44
mandanani16-May-05 23:44 
AnswerRe: VC++ certifications??? Pin
ddmcr17-May-05 0:28
ddmcr17-May-05 0:28 
AnswerRe: VC++ certifications??? Pin
rocky_pulley17-May-05 3:49
rocky_pulley17-May-05 3:49 
GeneralPlease help me Pin
microsoftcertificate16-May-05 23:14
sussmicrosoftcertificate16-May-05 23:14 
GeneralToolbar in "child" dialog Pin
AnTri16-May-05 22:59
AnTri16-May-05 22:59 
GeneralRe: Toolbar in "child" dialog Pin
AnTri17-May-05 2:54
AnTri17-May-05 2:54 
Generaldynamic mem alloc problem Pin
bilbobaggio16-May-05 22:29
bilbobaggio16-May-05 22:29 
Hi, I have two classes, say A and B

class A {
private:
...
int *p;
...
public:
...
~A() { delete [] p; }
int getData(int i) { return p[i]; }
}

class B {
private:
...
A *p;
...
public:
...
~B() { delete [] p; }
A getData(int i) { return p[i]; }
}

In my main code I create a class B with say A array of length 2 and each A has int array of length 5. The problem is if I loop through the objects trying to print out the values of the integer arrays, I get an error.

e.g. for(i=0;i<2;i++)
for(j=0;j<5;j++)
cout << bImpl.getData(i).getData(j);

This works for 'bImpl.p[0].p[0]' but gives an error for 'bImpl.p[0].p[1]', the reason being (i think !) that when 'bImpl.getData(i).getData(j)' returns it calls the destructor of class A and removes the pointer to the integer array. I think this is correct as if i remove the 'delete [] p' line from both the destructors, everything works fine. I know that this line of code is necessary and would appreciate any help.
GeneralRe: dynamic mem alloc problem Pin
Hans Ruck16-May-05 22:54
Hans Ruck16-May-05 22:54 
GeneralI have a problem with files Pin
sana55016-May-05 21:59
sana55016-May-05 21:59 
GeneralRe: I have a problem with files Pin
namaskaaram16-May-05 22:06
namaskaaram16-May-05 22:06 
GeneralRe: I have a problem with files Pin
toxcct17-May-05 1:34
toxcct17-May-05 1:34 
GeneralGet user from process (windows NT/XP) Pin
JaVinci16-May-05 21:47
JaVinci16-May-05 21:47 
GeneralRe: Get user from process (windows NT/XP) Pin
James R. Twine17-May-05 0:39
James R. Twine17-May-05 0:39 
GeneralRe: Get user from process (windows NT/XP) Pin
JaVinci17-May-05 3:12
JaVinci17-May-05 3:12 
GeneralRe: Get user from process (windows NT/XP) Pin
CodeBeetle26-May-05 7:43
CodeBeetle26-May-05 7:43 
QuestionHow to change the interface language using resource.rc? Pin
Kaworu216-May-05 21:31
Kaworu216-May-05 21:31 
AnswerRe: How to change the interface language using resource.rc? Pin
ThatsAlok16-May-05 21:38
ThatsAlok16-May-05 21:38 
GeneralUrgently need Help Pin
NityaKakkar16-May-05 21:06
NityaKakkar16-May-05 21:06 
GeneralRe: Urgently need Help Pin
ThatsAlok16-May-05 21:34
ThatsAlok16-May-05 21:34 
GeneralMFC dialog based app and edit control Pin
Rostfrei16-May-05 20:52
Rostfrei16-May-05 20:52 
GeneralRe: MFC dialog based app and edit control Pin
ThatsAlok16-May-05 20:58
ThatsAlok16-May-05 20:58 
GeneralRe: MFC dialog based app and edit control Pin
Rostfrei16-May-05 21:26
Rostfrei16-May-05 21:26 
GeneralRe: MFC dialog based app and edit control Pin
ThatsAlok16-May-05 21:29
ThatsAlok16-May-05 21:29 
GeneralRe: MFC dialog based app and edit control Pin
Rostfrei16-May-05 21:39
Rostfrei16-May-05 21:39 

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.