I have two classes, Date and Flight. In my Flight object I have Two date objects. I'm running into trouble when trying to initialize the Dates. My current code is below. I don't understand why what I'm doing doesn't work. The flight header file has a #include "Date.h" command, so by including the flight header, i include the date header, right? The errors say:
Flight.cpp: In constructor `Flight::Flight()':
Flight.cpp:7: error: no match for call to `(Date) (int, int, int)'
Flight.cpp:8: error: no match for call to `(Date) (int, int, int)'
Flight.cpp: In constructor `Flight::Flight(int, std::string, std::string, Date, Date)':
Flight.cpp:18: error: no match for call to `(Date) (int&, int&, int&)'
Flight.cpp:19: error: no match for call to `(Date) (int&, int&, int&)'
#include "Flight.h"
Flight::Flight() {
flightNum = 0;
origin = " ";
dest = " ";
dep(1,1,2000);
ret(1,1,2000);
}
Flight::Flight(int fNum, string _origin, string _dest, Date _dep, Date _ret) {
int d1 = _dep.day(), m1 = _dep.month(), y1 = _dep.year();
int d2 = _ret.day(), m2 = _ret.month(), y2 = _ret.year();
flightNum = fNum;
origin = _origin;
dest = _dest;
dep(d1, m1, y1);
ret(d2, m2, y2);
}