我现在正在使用C++进行模拟课程,并且在标题中引用了clang ++错误.我希望有人可以告诉我为什么,因为我似乎无法在任何地方找到类似的错误(尽可能搜索).
每个Office*变量定义都会发生错误(第187到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 …Run Code Online (Sandbox Code Playgroud) 所以我有一个"办公室"课程,我正在编写一个程序,每个"办公室"都有一定数量的柜员忙或闲.我想将这些计数器表示为Office类的私有int数组.我遇到的问题是,出纳员的数量是办公室类的声明参数,所以我不能去
private:
int tellers[num_tellers];
Run Code Online (Sandbox Code Playgroud)
我已经尝试了与构造函数不同的东西,但似乎没有任何工作.我该怎么做呢?我在网上看到的一切都是使用new运算符,但我没有兴趣使用指针.
提前致谢