Click here to Skip to main content
15,925,181 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Template without any content Pin
George_George19-Nov-07 1:04
George_George19-Nov-07 1:04 
GeneralRe: Template without any content Pin
Nelek19-Nov-07 1:10
protectorNelek19-Nov-07 1:10 
GeneralRe: Template without any content Pin
George_George19-Nov-07 1:20
George_George19-Nov-07 1:20 
GeneralRe: Template without any content Pin
Nelek19-Nov-07 1:47
protectorNelek19-Nov-07 1:47 
GeneralRe: Template without any content Pin
George_George19-Nov-07 4:30
George_George19-Nov-07 4:30 
AnswerRe: Template without any content Pin
Cedric Moonen19-Nov-07 1:13
Cedric Moonen19-Nov-07 1:13 
GeneralRe: Template without any content Pin
George_George19-Nov-07 4:31
George_George19-Nov-07 4:31 
Questionvariable declaration Pin
dadacncn18-Nov-07 23:42
dadacncn18-Nov-07 23:42 
what is the different between the declaration of a variable in the header file and the declareation in the .cpp file?
For expamle, in my program I need an object "helpUIDCache" to contain a value before all functions run. and after the run of all functions I'll delete it in deconstructor.

in constructor:
static bool isCreatedCacheFile = false;

if(!isCreatedCacheFile)
{
helpUIDCache = new HelpUIDCache;

if (!helpUIDCache->createTestFile())
{
CPPUNIT_ASSERT_MESSAGE("Error in helpUIDCache.",false);
}

isCreatedCacheFile = true;
}

if deconstructor:

static int numOfFunctions = 0;
numOfFunctions ++;
if (numOfFunctions == 8)
{
wprintf(L"backup file name: %s\n",helpUIDCache->getBackupFileName() );
helpUIDCache->restoreCacheFile();
delete helpUIDCache;
}

If I declare "HelpUIDCache* helpUIDCache;" in the header file, in deconstructor the attribut of the object helpUIDCache is null, by wprintf I can not get the file name from it. But if I declare it in .cpp, the attribut contains its value in deconstructor. so what is the scope of the variable declaration in header and in .cpp file?

thanks in advance!

AnswerRe: variable declaration Pin
manish.patel19-Nov-07 0:17
manish.patel19-Nov-07 0:17 
GeneralRe: variable declaration Pin
dadacncn19-Nov-07 0:34
dadacncn19-Nov-07 0:34 
GeneralRe: variable declaration Pin
manish.patel19-Nov-07 0:54
manish.patel19-Nov-07 0:54 
GeneralRe: variable declaration Pin
dadacncn19-Nov-07 1:24
dadacncn19-Nov-07 1:24 
QuestionProfiling C++ Applications: Available Tools? Pin
Tomerland18-Nov-07 23:31
Tomerland18-Nov-07 23:31 
AnswerRe: Profiling C++ Applications: Available Tools? Pin
Blake Miller21-Nov-07 4:19
Blake Miller21-Nov-07 4:19 
QuestionResizing the dialog box controls Pin
SnaKeBeD18-Nov-07 23:21
SnaKeBeD18-Nov-07 23:21 
AnswerRe: Resizing the dialog box controls Pin
Hamid_RT18-Nov-07 23:25
Hamid_RT18-Nov-07 23:25 
GeneralRe: Resizing the dialog box controls Pin
SnaKeBeD19-Nov-07 0:03
SnaKeBeD19-Nov-07 0:03 
QuestionRe: Resizing the dialog box controls Pin
Parthi_Appu19-Nov-07 0:47
Parthi_Appu19-Nov-07 0:47 
GeneralRe: Resizing the dialog box controls Pin
Hamid_RT19-Nov-07 3:52
Hamid_RT19-Nov-07 3:52 
AnswerRe: Resizing the dialog box controls Pin
David Crow19-Nov-07 3:47
David Crow19-Nov-07 3:47 
QuestionMultiple thread pool Pin
Jhony george18-Nov-07 23:19
Jhony george18-Nov-07 23:19 
AnswerRe: Multiple thread pool Pin
manish.patel19-Nov-07 0:27
manish.patel19-Nov-07 0:27 
GeneralRe: Multiple thread pool Pin
Cedric Moonen19-Nov-07 1:08
Cedric Moonen19-Nov-07 1:08 
AnswerRe: Multiple thread pool Pin
Cedric Moonen19-Nov-07 1:06
Cedric Moonen19-Nov-07 1:06 
GeneralRe: Multiple thread pool Pin
Jhony george19-Nov-07 1:16
Jhony george19-Nov-07 1:16 

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.