Click here to Skip to main content
15,918,808 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to load the values from the resourse file? Pin
julych11-Mar-03 18:20
julych11-Mar-03 18:20 
AnswerRe: How to load the values from the resourse file? Pin
KarstenK11-Mar-03 20:47
mveKarstenK11-Mar-03 20:47 
GeneralGet the memory leak position Pin
novachen11-Mar-03 17:32
novachen11-Mar-03 17:32 
GeneralRe: Get the memory leak position Pin
567890123411-Mar-03 19:56
567890123411-Mar-03 19:56 
GeneralRe: Get the memory leak position Pin
Chris Losinger12-Mar-03 1:49
professionalChris Losinger12-Mar-03 1:49 
GeneralRunning inside the main loop under MFC Pin
brandon187911-Mar-03 17:31
brandon187911-Mar-03 17:31 
GeneralRe: Running inside the main loop under MFC Pin
567890123411-Mar-03 19:57
567890123411-Mar-03 19:57 
GeneralC++ object oriented programming question. Pin
trustno111-Mar-03 17:11
trustno111-Mar-03 17:11 
i was studying c++ object oriented programming notes today and have some questions regarding to this problem.. any suggestion is welcome.. thank you!

for this question, i'm supposed to find the implementation error and fix it without changing the interface.

i read thru the codes and realized that the method B::Init() was trying to initialize the private variable, pNum, that belongs to class A(Class B's super class).. I was wondering is there anyway to access to class A's private variable from class B? and also have i missed any other implementation error?

class A
{
public:
A() { Init(); }
virtual ~A() { Destroy(); }
virtual void Init();
virtual void Destroy();
long Get() { return *pNum; }
void Set(long num) { *pNum = num; }
private:
long *pNum;
};

class B : public A
{
public:
B() { Init(); }
virtual ~B() { Destroy(); }
virtual void Init();
virtual void Destroy();
long Get2() { return *pNum; }
void Set2(long num) { *pNum = num; }
private:
long *pNum2;
};

void A::Init()
{
pNum = new long;
}

void A::Destroy()
{
delete pNum;
}

void B::Init()
{
pNum = new long;
pNum2 = new long;
}

void B::Destroy()
{
delete pNum2;
}

GeneralRe: C++ object oriented programming question. Pin
Christian Graus11-Mar-03 19:32
protectorChristian Graus11-Mar-03 19:32 
Generaluhhh ...Button click event...uhhh Pin
Brent Lamborn11-Mar-03 16:39
Brent Lamborn11-Mar-03 16:39 
GeneralRe: uhhh ...Button click event...uhhh Pin
Nish Nishant11-Mar-03 16:47
sitebuilderNish Nishant11-Mar-03 16:47 
GeneralRe: uhhh ...Button click event...uhhh Pin
Brent Lamborn11-Mar-03 16:55
Brent Lamborn11-Mar-03 16:55 
GeneralProgram Termination... Pin
ZarrinPour11-Mar-03 16:11
ZarrinPour11-Mar-03 16:11 
GeneralRe: Program Termination... Pin
Nish Nishant11-Mar-03 16:48
sitebuilderNish Nishant11-Mar-03 16:48 
GeneralRe: Program Termination... Pin
TomKat14-Mar-03 15:45
TomKat14-Mar-03 15:45 
QuestionHelp about Reading file from network? Pin
dxhdxh11-Mar-03 13:27
dxhdxh11-Mar-03 13:27 
AnswerRe: Help about Reading file from network? Pin
Brian Shifrin11-Mar-03 14:35
Brian Shifrin11-Mar-03 14:35 
GeneralNeed advise on getting back to the newly added record using AddNew Pin
ElizabethC11-Mar-03 12:50
ElizabethC11-Mar-03 12:50 
GeneralRe: Need advise on getting back to the newly added record using AddNew Pin
RaajaOfSelf11-Mar-03 17:03
RaajaOfSelf11-Mar-03 17:03 
GeneralRe: Need advise on getting back to the newly added record using AddNew Pin
ElizabethC12-Mar-03 5:43
ElizabethC12-Mar-03 5:43 
GeneralRe: Need advise on getting back to the newly added record using AddNew Pin
ramki kicha12-Mar-03 19:28
sussramki kicha12-Mar-03 19:28 
QuestionAnyone explain why this causes a BSOD? Pin
Ray Cassick11-Mar-03 10:40
Ray Cassick11-Mar-03 10:40 
AnswerRe: Anyone explain why this causes a BSOD? Pin
Christian Graus11-Mar-03 10:47
protectorChristian Graus11-Mar-03 10:47 
AnswerRe: Anyone explain why this causes a BSOD? Pin
David Wulff11-Mar-03 11:03
David Wulff11-Mar-03 11:03 
GeneralRe: Anyone explain why this causes a BSOD? Pin
Ray Cassick11-Mar-03 11:10
Ray Cassick11-Mar-03 11:10 

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.