10
I am extremely confused why I am getting this strange error all the sudden:
Time.h is a very simple class, and it has a semicolon at the end of the class description, so I am pretty sure my code is correct here.. Then I get the same errors in: Microsoft Visual Studio 10.0\VC\include\memory.. Any ideas!?!? Thanks!
Compiler Output
1>ClCompile:
1> Stop.cpp
1>c:\projectnextbus\Time.h(17): error C2143: syntax error : missing ';' before 'using'
1>c:\projectnextbus\Time.h(17): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1> NextBusDriver.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\memory(16): error C2143: syntax error : missing ';' before 'namespace'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\memory(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Update: Can't really post all the code as this is for a school project and we aren't supposed to post before we submit, but small snippets should be ok..
Time.h
#ifndef TIME_HPP
#define TIME_HPP
#include <string>
#include <sstream>
using namespace std;
class Time {
// Defines a time in a 24 hour clock
public:
// Time constructor
Time(int hours = 0 , int minutes= 0);
// POST: Set hours int
void setHours(int h);
// POST: Set minutes int
void setMinutes(int m);
// POST: Returns hours int
int getHours();
// POST: Returns minutes int
int getMinutes();
// POST: Returns human readable string describing the time
// This method can be overridden in inheriting classes, so should be virtual so pointers will work as desired
string toString();
private:
string intToString(int num);
// POST: Converts int to string type
int hours_;
int minutes_;
};
#endif
DepartureTime.h (inherited class)