私はc++プログラムに取り組んでおり、TextUserInterfaceクラスを作成し、mainメソッド内でそのインスタンスを呼び出そうとしています。これは、TextUserInterface.h、TextUserInterface.cpp、およびGasStationFinder.cpp(メインメソッドを収容)です。
#include <iostream>
using namespace std;
using namespace view; // compiler is comlaining here saying '<type error>' is not
// a namespace and expected namespace name before ;
#include "TextUserInterface.h"
int main() {
view::TextUserInterface tui;
tui.run();
return 0;
}
TextUserInterface.h
/*
* TextUserInterface.h
*
* Created on: Jan 27, 2013
* Author: Chris
*/
#ifndef TEXTUSERINTERFACE_H_
#define TEXTUSERINTERFACE_H_
namespace view {
class TextUserInterface {
public:
TextUserInterface();
void run();
virtual ~TextUserInterface();
};
} /* namespace view */
#endif /* TEXTUSERINTERFACE_H_ */
TextUserInterface.cpp
/*
* TextUserInterface.cpp
*
* Created on: Jan 27, 2013
* Author: Chris
*/
#include <iostream>
using namespace std;
#include "TextUserInterface.h"
namespace view {
TextUserInterface::TextUserInterface() {
// TODO Auto-generated constructor stub
}
void TextUserInterface::run(){
cout << "Welcome to the Gas Station Finder" << endl;
cout << "" << endl;
cout << "What would you like to query: (m)inimum price, ma(x)imum price,
(p)repay pumps, (t)hreshold price, (l)ist stations, (q)uit?" << endl;
}
TextUserInterface::~TextUserInterface() {
// TODO Auto-generated destructor stub
}
} /* namespace view */