Static data member

So I'm getting an error and I'm not sure why. I figured I would throw it out there to see if anyone can help me. I have a couple of classes. I want to use an instance of one class as a static data member in another, here's my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class MyObject 
{
private:
	int id;
	string name;
	static Pool pool;
	MyObject (int i, const string &nm );
	MyObject(const MyObject &x) {}; // I'll declare the copy constructor and assignment operator here so as to dissallow the use of them
	MyObject & operator =(const MyObject &x) {};
public:
	static MyObject* create(int id, const string& name); 
	void* operator new (size_t size);
	void operator delete (void *);
};

class Pool
{
private:
	MyObject* pt;
public:
	Pool(size_t elemSize, size_t blockSize = 5, bool traceFlag = false);
	void* allocate();
	void deallocate(void*); 
	~Pool ();

I'm trying to use a Pool object as a static data member of MyObject.
The error I'm getting is C2146 missing ';' before identifier 'pool'. I don't understand. Help?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class Pool ; // declare Pool

class MyObject 
{
private:
	int id;
	string name;
        static Pool pool;
        // etc. ...
};

class Pool
{
private:
    // etc. ...
};
Topic archived. No new replies allowed.