作者dream1203 (小叮噹)
看板EE_DSnP
標題[問題] 奇怪的問題…
時間Mon Jan 19 17:12:29 2009
請問為什麼不能在class裡面宣告ifstream的東西呀?
我的code如下,結果會error: `ifstream' does not name a type
為什麼會這樣呀?(看最後面有一個ifstream _ifile;)
//Gamemgr.h
#ifndef GAMEMGR_H
#define GAMEMGR_H
#include<iostream>
#include<fstream>
#define SIZE 75
class GAMEMGR
{
public:
GAMEMGR ();
void readArticle();
void play();
double getTotalWords () { return _wordsTotal; }
int getMissedWords () { return _wordsMissed; }
double getSpeed () { return _speed; }
bool getEOF() { return _ifile.eof(); }
private:
unsigned long _timeStart;
unsigned long _timeEnd;
double _wordsTotal;
double _speed;
double _timePassed;
int _wordsMissed;
int _spacing;
char _str[SIZE];
char _tmp[SIZE];
ifstream _ifile;
};
#endif
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.241.211
1F:推 timrau:因為少了using std::ifstream; 01/19 17:19
2F:→ dream1203:謝謝= =a…我神經大條… 01/19 17:42