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

C / C++ / MFC

 
GeneralRe: unresolved external symbol _wWinMain@16 Pin
Raghavendra Pise7-Nov-06 0:34
Raghavendra Pise7-Nov-06 0:34 
QuestionWrite text to the command prompt in Dlg based Appln. Pin
zxc896-Nov-06 19:30
zxc896-Nov-06 19:30 
AnswerRe: Write text to the command prompt in Dlg based Appln. Pin
fat_boy6-Nov-06 23:50
fat_boy6-Nov-06 23:50 
QuestionBackup policy algorithm. Pin
baldha rakesh6-Nov-06 19:16
baldha rakesh6-Nov-06 19:16 
QuestionAbout Dll's Pin
Neeraj Sinha6-Nov-06 19:14
Neeraj Sinha6-Nov-06 19:14 
AnswerRe: About Dll's Pin
Hamid_RT6-Nov-06 20:06
Hamid_RT6-Nov-06 20:06 
Questionproblems on mutual class declaration introduction between classes Pin
cy163@hotmail.com6-Nov-06 18:37
cy163@hotmail.com6-Nov-06 18:37 
AnswerRe: problems on mutual class declaration introduction between classes [modified] Pin
Steve Echols6-Nov-06 18:51
Steve Echols6-Nov-06 18:51 
There's a couple of ways around the circular dependency problem:

a) Put your declarations in .h and put your definitions in .cpp.
b) Declare your classes, then in the same .h, put the definitions with the dependencies outside of the class.

a)

.h:

// Forward declarations (or includes)<br />
class Class_A;<br />
class Class_B;<br />
<br />
class Class_A<br />
{<br />
    Class_B* _b;<br />
<br />
    void func();<br />
};<br />
<br />
class Class_B<br />
{<br />
    Class_A* _a;<br />
<br />
    void func();<br />
};<br />

.cpp:

void Class_A::func()<br />
{<br />
    _b->func();<br />
}<br />
<br />
void Class_B::func()<br />
{<br />
    _a->func();<br />
}<br />



b)

.h:

// Forward declarations (or includes)<br />
class Class_A;<br />
class Class_B;<br />
<br />
class Class_A<br />
{<br />
    Class_B* _b;<br />
<br />
    void func();<br />
};<br />
<br />
class Class_B<br />
{<br />
    Class_A* _a;<br />
<br />
    void func();<br />
};<br />
<br />
<br />
// Definitions<br />
void Class_A::func()<br />
{<br />
    _b->func();<br />
}<br />
<br />
void Class_B::func()<br />
{<br />
    _a->func();<br />
}<br />

In either case, the classes are declared, then the class functions are defined after they're declared.



-- modified at 2:31 Tuesday 7th November, 2006


- S
50 cups of coffee and you know it's on!

GeneralRe: problems on mutual class declaration introduction between classes Pin
Cedric Moonen6-Nov-06 20:25
Cedric Moonen6-Nov-06 20:25 
GeneralRe: problems on mutual class declaration introduction between classes Pin
Steve Echols6-Nov-06 20:29
Steve Echols6-Nov-06 20:29 
GeneralRe: problems on mutual class declaration introduction between classes Pin
cy163@hotmail.com7-Nov-06 2:25
cy163@hotmail.com7-Nov-06 2:25 
GeneralRe: problems on mutual class declaration introduction between classes Pin
Cedric Moonen7-Nov-06 2:42
Cedric Moonen7-Nov-06 2:42 
GeneralRe: problems on mutual class declaration introduction between classes [modified] Pin
cy163@hotmail.com7-Nov-06 12:15
cy163@hotmail.com7-Nov-06 12:15 
GeneralRe: problems on mutual class declaration introduction between classes Pin
Cedric Moonen7-Nov-06 20:23
Cedric Moonen7-Nov-06 20:23 
GeneralRe: problems on mutual class declaration introduction between classes Pin
cy163@hotmail.com8-Nov-06 0:52
cy163@hotmail.com8-Nov-06 0:52 
GeneralRe: problems on mutual class declaration introduction between classes [modified] Pin
cy163@hotmail.com7-Nov-06 2:19
cy163@hotmail.com7-Nov-06 2:19 
QuestionCListCtrl Pin
kk.tvm6-Nov-06 18:18
kk.tvm6-Nov-06 18:18 
AnswerRe: CListCtrl Pin
prasad_som6-Nov-06 18:36
prasad_som6-Nov-06 18:36 
AnswerRe: CListCtrl Pin
Nibu babu thomas6-Nov-06 18:43
Nibu babu thomas6-Nov-06 18:43 
AnswerRe: CListCtrl Pin
Hamid_RT7-Nov-06 4:20
Hamid_RT7-Nov-06 4:20 
QuestionHow to get IHTMLElement using elementFromPoint in Frame? Pin
31415926536-Nov-06 18:09
31415926536-Nov-06 18:09 
QuestionHow to highlight a Check box if no caption Pin
vikas amin6-Nov-06 18:07
vikas amin6-Nov-06 18:07 
AnswerRe: How to highlight a Check box if no caption Pin
Hamid_RT6-Nov-06 20:18
Hamid_RT6-Nov-06 20:18 
GeneralRe: How to highlight a Check box if no caption Pin
vikas amin6-Nov-06 21:28
vikas amin6-Nov-06 21:28 
GeneralRe: How to highlight a Check box if no caption Pin
Hamid_RT7-Nov-06 4:31
Hamid_RT7-Nov-06 4:31 

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.