Click here to Skip to main content
15,888,984 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralThanks Pin
CPallini15-Dec-07 5:21
mveCPallini15-Dec-07 5:21 
Generalnon-const reference and const reference Pin
George_George14-Dec-07 17:48
George_George14-Dec-07 17:48 
GeneralRe: non-const reference and const reference Pin
Iain Clarke, Warrior Programmer14-Dec-07 22:36
Iain Clarke, Warrior Programmer14-Dec-07 22:36 
GeneralRe: non-const reference and const reference Pin
George_George15-Dec-07 4:02
George_George15-Dec-07 4:02 
GeneralRe: non-const reference and const reference Pin
Iain Clarke, Warrior Programmer15-Dec-07 4:17
Iain Clarke, Warrior Programmer15-Dec-07 4:17 
GeneralRe: non-const reference and const reference Pin
George_George15-Dec-07 19:27
George_George15-Dec-07 19:27 
QuestionQuestion about redeclaring header files Pin
(Steven Hicks)n+114-Dec-07 15:37
(Steven Hicks)n+114-Dec-07 15:37 
GeneralRe: Question about redeclaring header files Pin
Iain Clarke, Warrior Programmer14-Dec-07 22:56
Iain Clarke, Warrior Programmer14-Dec-07 22:56 
Think about what you're written.

I'll define testtwo, which needs to know about testone, which needs to know about testtwo, which needs to know about testone, which needs to know about testtwo, which needs to know about testone, which needs to know about testtwo, which needs to know about testone, which needs to know about testtwo, which needs to know about testone, which needs to know about testtwo, which needs to know about testone, which needs to know about testtwo, which needs to know about testone, which needs to know about testtwo, which needs to know about testone, which needs to know about testtwo, which needs to know about testone, which needs to know about testtwo,.....

Ok, I'm fed up - and so was your compiler.

Which is probably which you use'd #pragma once, or
#ifndef TESTTWO_H
#define TESTTWO_H

class testtwo
... etc
#endif


But that just means...

I'll define testone, which needs about testone. So I'll include testone.h - which needs to know about testtwo. so, I'll include testone.h... which appears to be empty! whaaah!

So what you do is....

// guard against being re-included. therein lies madness.
#ifndef TESTTWO_H
#define TESTTWO_H

class testone;    // see outside pre block

class testtwo
{
    ....
    testone *one;
};

#endif


What we've done is tell the compiler "I'll get round to telling you all about testone later, but I'll tell you now that there is such a class."

And do vice versa in testone.h

Now you need to have both headers included into your .C file before you can actually DO anything useful with the pointer, but you've escaped your circular dependency!


Iain.
Question"Out Of Memory" When using CString GetBuffer() [modified] Pin
nadiric14-Dec-07 14:09
nadiric14-Dec-07 14:09 
QuestionAdditional Info - "Out Of Memory" When using CString GetBuffer() Pin
nadiric14-Dec-07 15:15
nadiric14-Dec-07 15:15 
GeneralRe: Additional Info - "Out Of Memory" When using CString GetBuffer() Pin
nadiric14-Dec-07 15:37
nadiric14-Dec-07 15:37 
GeneralRe: "Out Of Memory" When using CString GetBuffer() Pin
Mark Salsbery15-Dec-07 8:18
Mark Salsbery15-Dec-07 8:18 
GeneralRe: "Out Of Memory" When using CString GetBuffer() Pin
nadiric15-Dec-07 8:59
nadiric15-Dec-07 8:59 
GeneralRe: "Out Of Memory" When using CString GetBuffer() Pin
Mark Salsbery15-Dec-07 9:06
Mark Salsbery15-Dec-07 9:06 
GeneralHELP, in both senses Pin
Anthony Appleyard14-Dec-07 13:01
Anthony Appleyard14-Dec-07 13:01 
GeneralRe: HELP, in both senses Pin
santhoshv8414-Dec-07 17:33
santhoshv8414-Dec-07 17:33 
GeneralRe: HELP, in both senses Pin
Anthony Appleyard14-Dec-07 19:35
Anthony Appleyard14-Dec-07 19:35 
GeneralRe: HELP, in both senses Pin
nitin314-Dec-07 21:02
nitin314-Dec-07 21:02 
GeneralRe: HELP, in both senses Pin
santhoshv8414-Dec-07 21:07
santhoshv8414-Dec-07 21:07 
GeneralRe: HELP, in both senses Pin
Mark Salsbery15-Dec-07 8:20
Mark Salsbery15-Dec-07 8:20 
QuestionDisplay file details Pin
GPat2414-Dec-07 11:36
GPat2414-Dec-07 11:36 
GeneralRe: Display file details [modified] Pin
Mark Salsbery14-Dec-07 11:58
Mark Salsbery14-Dec-07 11:58 
GeneralRe: Display file details Pin
Hamid_RT14-Dec-07 21:20
Hamid_RT14-Dec-07 21:20 
QuestionRe: Display file details Pin
GPat2415-Dec-07 23:49
GPat2415-Dec-07 23:49 
QuestionRestricting security in web browser control Pin
drummer14-Dec-07 11:35
drummer14-Dec-07 11:35 

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.