Hi everyone. I pretty new to C/C++. Heres my code:
Code:#include "Environment.h" int Environment :: nExist = 0; int Environment :: nCreated = 0; Environment :: Environment(void){ serNo = ++nCreated; nExist++; char buffer[100]; sprintf(buffer, "Environment%d", serNo); label = new char[strlen(buffer) + 1]; strcpy(label, buffer); return; }//Environment :: Environment(void)Code:#ifndef SIMULATION_H #define SIMULATION_H #include "Environment.cpp" using namespace std; class Simulation { private: Environment env; int serNo; static int nExist, nCreated; public: Simulation(void); Simulation(const Environment *); Simulation(const Simulation&); ~Simulation(); const Simulation & operator = (const Simulation&); void print(void) const; };Heres the Error:Code:#include "Simulation.h" int Simulation :: nExist = 0; int Simulation :: nCreated = 0; Simulation :: Simulation(void){ serNo = ++nCreated; nExist++; env = new Environment(void); return; }//Simulation :: Simulation(void)
Any help would be greatly appreciatedCode:Simulation.cpp: In constructor `Simulation::Simulation()': Simulation.cpp:9: error: expected primary-expression before "void"



LinkBack URL
About LinkBacks



