Hello folks,
I have this header file:
class Agent {
private:
struct AgentStruct {
std::string agentName;
double pID;
double mID;
AgentStruct *nextAgent;
} *AgentP;
public:
Agent(std::string);
void SetNextAgent(AgentStruct*);
Agent* GetNextAgent();
void SendMessage();
void ReceiveMessage();
};
and I have the implementation here:
/*
* The constructor we are required to implement.
*/
Agent::Agent(std::string name) {
AgentP->nextAgent=NULL;
AgentP->agentName=name;
AgentP->pID=setPID();
AgentP->mID=AgentP->pID;
}
I get a segmentation fault.
Any ideas?
thanks!