system crash after declaring global object of the class

Posted by coming out of void on Stack Overflow See other posts from Stack Overflow or by coming out of void
Published on 2010-04-16T05:42:21Z Indexed on 2010/04/16 5:43 UTC
Read the original article Hit count: 206

Filed under:
|
|
|
|

hi,
i am very new to c++. i am getting system crash (not compilation error) in doing following:

i am declaring global pointer of class.

BGiftConfigFile  *bgiftConfig;
class BGiftConfigFile : public EftBarclaysGiftConfig { }

in this class i am reading tags from xml file. it is crashing system when this pointer is used to retrieve value. i am doing coding for verifone terminal.

int referenceSetting = bgiftConfig->getreferencesetting(); //system error

getreferencesetting() is member fuction of class EftBarclaysGiftConfig

i am confused about behavior of pointer in this case. i know i am doing something wrong but couldn't rectify it.

When i declare one object of class locally it retrieves the value properly.

BGiftConfigFile  bgiftConfig1; 
int referenceSetting = bgiftConfig1->getreferencesetting(); //working

But if i declare this object global it also crashes the system.

i need to fetch values at different location in my code so i forced to use someting global.

please suggest me how to rectify this problem.

© Stack Overflow or respective owner

Related posts about c++

Related posts about c