I am taking a C ++ modeling course right now and I am getting the clang ++ error indicated in the title. I was hoping someone would tell me why, because I cannot find a similar error for a similar situation anywhere (search how I can).
An error occurs for each Office* variable definition (lines 187 through 190).
175 class EventHandler { 176 177 private: 178 double simulation_time; // current simulation time 179 Office* aid, bursar, registrar, parking; 180 Event* current_event; 181 MinHeap* time_heap; 182 183 public: 184 185 void initialize_simulation() { // initializes simulation time, offices, and event handler (time_heap) 186 simulation_time = 0; 187 aid = new Office(8, Tf); // initializes financial aid office with Tf tellers, with serve time exponentially distributed with mean of 8 minutes 188 bursar = new Office(15, Tb); // initializes bursar office w/ Tb tellers, exp distro, mean 15 min 189 registrar = new Office(5, Tr); // registrar w/ Tr tellers, exp distro, mean 5 min 190 parking = new Office(10,Tp); // parking office w/ Tp tellers, exp distro, mean 10 192 MinHeap* time_heap = new MinHeap(); 193 }
If I replace the Office* aid declaration (for example) and change aid = new Office(15, Tf) to Office* aid = new Office(15, Tf) , the error will disappear. I donβt know why, and I would really like it because I want all these class pointers to be private .
Interesting (annoying?), MinHeap* time_heap; time_heap = new MinHeap(); MinHeap* time_heap; time_heap = new MinHeap(); does not cause any problems. I thought this could be due to declaring the var pointer as private , and then defining it in the public part of the class, but it looks like it isn't.
help? = |
source share