定义了队列和airportSim类。
class Queue
{
public:
Queue(int setSizeQueue = 20);
//Queue's contents
}
class airportSim
{
public:
airportSim(int setSizeRunway = 20);
private:
Queue airQueue;
Queue groundQueue;
//Other airportSim contents.
}
Queue::Queue(int setSizeQueue)
{
//Contents of airportSim constructor supposed to come here.
}
airportSim::airportSim(int setSizeRunway)
{
airQueue(setSizeRunway);
groundQueue(setSizeRunway);
}
它说它无法访问构造函数。任何人都知道如何定义队列的构造函数?
答案 0 :(得分:1)
使用initialization list语法:
airportSim::airportSim(int setSizeRunway)
: airQueue(setSizeRunway),
groundQueue(setSizeRunway)
{
}