Obscure Syntax

T

tw2035

HI,

I have had a 5 year Java holiday from C++ and seem to have become super
rusty.
Can anyone tell me what this syntax below means (inside "THIS CODE
HERE" comment):

......
......
#include <iostream>
#include <cmath>

using namespace std;

// THIS CODE HERE --->
StaticSynapse::NeuronConnector StaticSynapse::Connect;
DynamicSynapse::NeuronConnector DynamicSynapse::Connect;
// <----------------------------------


Synapse::Synapse(SynapseProperties& synProps):
dendrite(0),
lastTransTime(0)
{
....
....

I dont mean what it does in this context but what is it? A Forward
declaration or something? It seems to have the form "ClassA ClassB;"

I would really appreciate any tips.
Cheers

Bster
 
T

Tomás

// THIS CODE HERE --->
StaticSynapse::NeuronConnector StaticSynapse::Connect;
DynamicSynapse::NeuronConnector DynamicSynapse::Connect;
// <----------------------------------

Looks like:

"StaticSynapse" is a class
"NeuronConnector" is a type which is defined within the class.
"Connect" is a static member.


It looks like this is the definition of the static member objects.


class Synapse
{
typedef int NeuronConnector;
};

class StaticSynapse : public Synapse
{
static NeuronConnector Connect; //static member data declaration
};

class DynamicSynapse : public Synapse
{
static NeuronConnector Connect; //static member data declaration

};


//Here's where the objects are actually defined
StaticSynapse::NeuronConnector StaticSynapse::Connect;
DynamicSynapse::NeuronConnector DynamicSynapse::Connect;



-Tomás
 
T

tw2035

Thanks a lot.
I was thrown by the capitalisation. I thought it was:
NAMESPACEA::CLASSA NAMESPACEA::CLASSB;
NAMESPACEB::CLASSC NAMESPACEB::CLASSC;

But I see now.

Bster
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,130
Latest member
MitchellTe
Top