Click here to Skip to main content
15,899,754 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionSwitching from console to application window Pin
klboy1-Sep-05 23:15
klboy1-Sep-05 23:15 
AnswerRe: Switching from console to application window Pin
Cedric Moonen1-Sep-05 23:46
Cedric Moonen1-Sep-05 23:46 
GeneralRe: Switching from console to application window Pin
klboy2-Sep-05 0:11
klboy2-Sep-05 0:11 
QuestionHowI compress string into a compressed string? Pin
nk1231-Sep-05 22:38
nk1231-Sep-05 22:38 
AnswerRe: HowI compress string into a compressed string? Pin
HasanMalaysia2-Sep-05 0:23
HasanMalaysia2-Sep-05 0:23 
QuestionAutomating Power Point into my MFC Dialogue ? Pin
Amarelia1-Sep-05 22:34
Amarelia1-Sep-05 22:34 
AnswerRe: Automating Power Point into my MFC Dialogue ? Pin
Eytukan1-Sep-05 22:59
Eytukan1-Sep-05 22:59 
Question2 Class Circular Reference Pin
Fehma1-Sep-05 22:25
Fehma1-Sep-05 22:25 
Hi there, I am using Visual C++ ( 2003 IDE ) and I need to have 2 classes which points to each other. ( The need to be able to call Functions on each other !!!!!
It works fine from mb->ma but when I call mb from ma I get an error : "Use of undefined Typ" or similiar

Can someone help me. Just need to have 2 Classes being able to call funtions on each other...

<br />
////////////////////////////////////////////////////////////////////////////<br />
// Forward Deklaration<br />
class mb;<br />
<br />
class ma<br />
{<br />
    friend class mb;<br />
public:<br />
    ma();<br />
    int ausgabe;<br />
    int mein(void);<br />
    int Callb(void);<br />
    void SetParent(mb *aptrb);<br />
protected:<br />
    mb *_ptrb;<br />
};<br />
int ma::Callb()<br />
{<br />
    int    lreturn = 0;<br />
    mb *lptr = _ptrb;<br />
    //lreturn =  lptr->richtig();            <br />
    //lreturn =  (*lptr).richtig();    <-- Fehler: Hier geht das nicht<br />
    return lreturn;<br />
}<br />
void ma::SetParent(mb *aptrb)<br />
{<br />
    _ptrb = aptrb;<br />
}<br />
ma::ma()<br />
{<br />
    int a = 2;<br />
}<br />
int ma::mein()<br />
{<br />
    return ausgabe;<br />
}<br />
////////////////////////////////////////////////////////////////////////////<br />
class mb<br />
{<br />
public:<br />
    mb();<br />
    ~mb();<br />
    void tuewas(void);<br />
    int richtig(void);<br />
    void SetParent(ma *aptra);<br />
protected:<br />
    ma *ptra;<br />
};<br />
int mb::richtig()<br />
{<br />
    return 500;<br />
}<br />
void mb::SetParent(ma *aptra)<br />
{<br />
    ptra = aptra;<br />
}<br />
mb::mb()<br />
{<br />
    int a = 2;<br />
}<br />
mb::~mb()<br />
{<br />
    int b = 2;<br />
}<br />
void mb::tuewas()<br />
{<br />
    int a = 2;<br />
    // A aufrufen<br />
    ma  *p = ptra;<br />
    if ( p != 0 )<br />
    {<br />
        a = p->mein();<br />
        a = a + 3;<br />
        p->Callb();<br />
       <br />
    }<br />
}<br />
////////////////////////////////////////////////////////////////////////////<br />

AnswerRe: 2 Class Circular Reference Pin
Cedric Moonen1-Sep-05 22:30
Cedric Moonen1-Sep-05 22:30 
GeneralRe: 2 Class Circular Reference Pin
Fehma1-Sep-05 22:34
Fehma1-Sep-05 22:34 
GeneralRe: 2 Class Circular Reference Pin
Cedric Moonen1-Sep-05 22:50
Cedric Moonen1-Sep-05 22:50 
GeneralRe: 2 Class Circular Reference Pin
Fehma1-Sep-05 23:08
Fehma1-Sep-05 23:08 
GeneralRe: 2 Class Circular Reference Pin
Cedric Moonen1-Sep-05 23:20
Cedric Moonen1-Sep-05 23:20 
GeneralRe: 2 Class Circular Reference Pin
Fehma1-Sep-05 23:55
Fehma1-Sep-05 23:55 
GeneralRe: 2 Class Circular Reference Pin
Cedric Moonen1-Sep-05 23:59
Cedric Moonen1-Sep-05 23:59 
GeneralRe: 2 Class Circular Reference Pin
Fehma2-Sep-05 0:06
Fehma2-Sep-05 0:06 
GeneralRe: 2 Class Circular Reference Pin
Fehma2-Sep-05 2:09
Fehma2-Sep-05 2:09 
QuestionStatic Control Background Painting Pin
Joel Holdsworth1-Sep-05 22:15
Joel Holdsworth1-Sep-05 22:15 
AnswerRe: Static Control Background Painting Pin
Neagoe Gabriel2-Sep-05 0:04
Neagoe Gabriel2-Sep-05 0:04 
GeneralRe: Static Control Background Painting Pin
Joel Holdsworth2-Sep-05 1:15
Joel Holdsworth2-Sep-05 1:15 
QuestionDifference between Instance and Context Pin
badal_akr1-Sep-05 21:42
badal_akr1-Sep-05 21:42 
AnswerRe: Difference between Instance and Context Pin
toxcct1-Sep-05 21:50
toxcct1-Sep-05 21:50 
QuestionSetForeGroundWindow with XP Pin
dharani1-Sep-05 21:02
dharani1-Sep-05 21:02 
AnswerRe: SetForeGroundWindow with XP Pin
khan++1-Sep-05 21:09
khan++1-Sep-05 21:09 
AnswerRe: SetForeGroundWindow with XP Pin
ThatsAlok2-Sep-05 0:07
ThatsAlok2-Sep-05 0:07 

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.