When trying to construct a class object containing another class object, I get the error:
"no matching function call to "PlaneId:laneId
candidates are: pLaneId:laneId(const PlaneId&)
PlaneId:laneId(const std::string&, int)"
Here are my two class files:
I get this error without even attempting to create an instance of the object...any ideas?
"no matching function call to "PlaneId:laneId
candidates are: pLaneId:laneId(const PlaneId&)
PlaneId:laneId(const std::string&, int)"
Here are my two class files:
Code:
// File: Planes.h
#ifndef Planes_h_
#define Planes_h_
#include "PlaneId.h"
enum PlaneStatusType { UNASSIGNED, IN_RANGE, IN_LANDING_QUEUE, IN_TAKEOFF_QUEUE, LANDED,
TOOK_OFF, EMERGENCY, CRASHED };
class LandingPlane {
public:
LandingPlane( PlaneId const& id, int scheduled_minute, int minutes_until_arrival,
int fuel_minutes_remaining, int num_passengers )
{ m_id = id; m_scheduled_minute = scheduled_minute;
m_minutes_until_arrival = minutes_until_arrival;
m_fuel_minutes_remaining = fuel_minutes_remaining;
m_passengers = num_passengers; }
PlaneId const& id() const { return m_id; }
PlaneStatusType status() const { return m_status; }
int scheduled_minute() const { return m_scheduled_minute; }
int on_ground_minute() const { return m_landed_or_crashed_minute; }
int minutes_until_arrival() const { return m_minutes_until_arrival; }
int fuel_minutes_remaining() const { return m_fuel_minutes_remaining; }
int runway_number() const { return m_runway; }
int minutes_in_queue() const { return m_in_queue_minutes; }
int num_passengers() const { return m_passengers; }
int delay() const { return m_landed_or_crashed_minute - m_scheduled_minute; }
void increment_minute( );
void assign_to_runway( int runway_number );
void land_plane( int minute );
void crash_plane( int minute );
private:
PlaneId m_id;
PlaneStatusType m_status;
int m_scheduled_minute;
int m_landed_or_crashed_minute;
int m_passengers;
int m_minutes_until_arrival;
int m_fuel_minutes_remaining;
int m_in_queue_minutes;
int m_runway;
};
Code:
// File: PlaneId.h
#ifndef PlaneId_h_
#define PlaneId_h_
#include <string>
using namespace std;
class PlaneId {
public:
PlaneId( string const& airline, int number )
{ m_airline = airline; m_number = number; }
string const& airline() const { return m_airline; }
int number() const { return m_number; }
void set_airline(string a) { m_airline = a; }
void set_number(int n) { m_number = n; }
private:
string m_airline;
int m_number;
};
bool operator< ( PlaneId const& p1, PlaneId const& p2 )
{ return p1.number() < p2.number(); }
bool operator== ( PlaneId const& p1, PlaneId const& p2 )
{ return p1.number() == p2.number(); }
#endif
I get this error without even attempting to create an instance of the object...any ideas?