I get some errors i can't interpret..
Code:// Class CONTRACT: Handles the rental contract details #include <string> #include <iosfwd> class Date; class Contract { public: Contract(); void SetContractDetails(Date i, unsigned carR, const std::string& kms, float ratePD, unsigned lndrID, const::std string& contID, int days); // First 3 errors points to this declaration void SetContractPeriod(Date i_dt, Date r_dt, int d, bool isLtd); void SetReturnDate(); void DisplayContract(); void Read(std::istream&, Contract&, bool); void Write(std::ostream&, bool); const std::string& getContractID() const; int getContractPeriod() const; float getRatePerDay() const; const std::string& getKmType() const; Date getIssueDate() const; Date getReturnDate() const; unsigned getLenderID() const; unsigned getCarReg() const; private: std::string contractID; Date issued, returned; unsigned lenderID; unsigned carRegistration; int contractDays; std::string kmType; float dailyRate; }; std::istream& operator >> (std::istream& in, Contract& rental);Here's my Date ClassCode:[errors] : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int : error C2751: 'std' : the name of a function parameter cannot be qualified : error C2146: syntax error : missing ',' before identifier 'string' : error C2079: 'Contract::issued' uses undefined class 'Date' : error C2079: 'Contract::returned' uses undefined class 'Date' : error C2228: left of '.getDay' must have class/struct/union etc..
Code:// Class DATE : Handles the car return and issue dates #include <time.h> #ifndef DATE_H #define DATE_H class Date { public: Date() { SetDate( getCurrentTime() ); } void SetDate(tm curr_tm) { day = curr_tm.tm_mday; month = curr_tm.tm_mon; year = curr_tm.tm_year; hour = curr_tm.tm_hour; minute = curr_tm.tm_min; local_dt = curr_tm; } int getDay(){return day;} int getMonth(){return month;} int getYear(){return year;} int getHour(){return hour;} int getMinute(){return minute;} tm getLocalDT(){return local_dt;} private: int day; int month; int year; int hour; int minute; tm local_dt; }; // Get the local date and time of system std::tm getCurrentTime() { std::time_t rawtime; std::tm* timeinfo; std::time( &rawtime ); timeinfo = std::localtime ( &rawtime ); return *timeinfo; } #endif



LinkBack URL
About LinkBacks




I used to be an adventurer like you... then I took an arrow to the knee.