Another general C++ question

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Another general C++ question

Post by Tyn »

Hey

I have some code to draw a background, it's inside an inherited class from a base class and the function is called by the base class. I call it like this:

Code: Select all

IMainMenu mainMenu;
mainMenu.loadMainMenu();
Now, the code inside the function definatly works, I substituted it for the function and it loaded fine, but when I try to call it as above it crashes when I try to run the program, the debugger points to the first line of my function loadMainMenu(). Has anyone else seen this and know what to do about it?
Mercior
Posts: 100
Joined: Tue Feb 24, 2004 1:53 am
Location: UK
Contact:

Post by Mercior »

You could try using a pointer:

Code: Select all

IMainMenu *mainMenu = new IMainMenu(); 
mainMenu->loadMainMenu();
You may even want to build the loadMainMenu() code into the IMainMenu constructor.
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

Cheers, I've never seen that b4.
Post Reply