Queue and airportSim classes are defined.
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 sup开发者_高级运维posed to come here.
}
airportSim::airportSim(int setSizeRunway)
{
airQueue(setSizeRunway);
groundQueue(setSizeRunway);
}
It says it has trouble accessing the constructors. Anyone know how to define the constructor of the queues?
Use the initialization list syntax:
airportSim::airportSim(int setSizeRunway)
: airQueue(setSizeRunway),
groundQueue(setSizeRunway)
{
}
精彩评论