Anyone know why this doesn't work... I cut the problem to this simple
form, only one source file (main.cpp). I'm getting an undefined
reference to foo::m_instance. If m_instance were not defined as static
all would be ok.
I'm using Dev-cpp ver 4.9.8.3
Help appreciated...
#include <iostream>
#include <stdlib.h>
using namespace std;
class foo {
private:
static foo* m_instance;
public:
static foo* Instance();
};
foo* foo::Instance()
{
if (m_instance == NULL)
m_instance = new foo;
return m_instance;
}
int main(int argc, char *argv[])
{
system("PAUSE");
return 0;
}
--
Philippe Parent
Programmer Analyst
Integrated Technology Services
University of New Brunswick
PO Box 4400
Fredericton, NB, Canada, E3B 5A3
Phone (506) 453 3563
Fax (506) 453 3590
|