So, in the course of a simulation of a neural network I have two classes: neurons and synapses (which are basically the coupling between neurons).
Synapses mediate information between neurons, so a neuron has to be able to speak to a synapse, and that synapse has to be able to speak to other neurons. To me, that means a neuron has to contain a pointer to a synapse, and a synapse has to contain a pointer to a neuron.
How do I do that? Just writing
class a
{
b* bpointer;
};
class b
{
a* apointer
};
will lead to an error because b is not defined when the compiler gets to a. is the solution to make both classes derivations of a third, very abstract class? except for this detail, neurons and synapses have nothing in common.