I've stripped it down to short files illustrating the issue (I was actually hoping to find the issue, but it didn't happen). I'm sure I'm missing some basic concept here, but I'm at a loss so any help would be appreciated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
//main.cpp
#include <cstdlib>
#include <iostream>
#include "overworld.h"
using std::cout;
using std::cin;
int main(int argc, char *argv[])
{
Overworld (theGame);
shortunsigned exitStatus = theGame.arenaExterior();
return exitStatus;
}
Overworld::Overworld()
{
//This is a local variable called pTheUser - not the class member of the same name.
//This local variable will dissapear once the constructor finishes, which is what causes the
//Overworld::arenaExterior() function to crash (plus it also creates a memory leak)
Player *pTheUser = new Player();
}