Circular Class References?

First, I apologize, as my question is most likely trivial; I have, however, done numerous searches and read a post on this very topic, but something is still not getting through my thick head and I can't figure out how to do this (seemingly simple) declaration.

Here's the culprit code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class neuron {
	public:
		int synapses;
		int type;
		int param[3];
		synapse synapse[10];
};

class synapse {
	public:
		neuron* transmitter;
		neuron* receiver;
		float weight;
};


So what I'm after is a neuron that has "synapse" objects. Problem is, the synapses must contain points to the parent neuron (transmitter) and target neuron (receiver).

Getting error:
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Compiler obviously doesn't understand the line "synapse synapse[10];". Please note that I have tried putting the synapse class before the neuron class to no avail.

Could someone be so kind as to clue me in?

Greatly appreciated!
Put synapse above neuron, then forward declare neuron (since you are only using pointers).

For more info, check here:
http://www.cplusplus.com/forum/articles/10627/
(Section 4)
Thanks enormously. Knew I was missing something. Wasn't sure what "forward declare" meant, but figured it out.
Topic archived. No new replies allowed.