I'm currently trying to initialise a private istream variable in class. The class definition looks like:
#define PARSER_H
class parser {
public:
parser();
parser(string predict_table_file_name);
private:
int getMaxRHS(string predict_table_file_name);
int getMaxPairs(string predict_table_file_name);
int getMaxPairsY(string predict_table_file_name);
int getMaxRHSY(string predict_table_file_name);
int getMaxSymbols(string predict_table_file_name);
int getGoalSymbol(string predict_table_file_name);
int getNumberOfTerminalSymbols(string predict_table_file_name);
string getSymbol(int symbolID);
string getToken();
string openFile(string sourceFile);
bool isTerminalSymbol(string token, string symbolArray[], int terminalSymbols);
istream scanFile;
};
#endif
The variable in question is "istream scanFile". The code I'm using to try and initialize it looks like this.
string parser::openFile(string sourceFile) {
filebuf fb;
fb.open(sourceFile.c_str(), ios::in);
parser::scanFile(&fb);
}
The line "parser::scanFile(&fb);" is giving me the trouble. Apparently the compiler thinks I'm trying to call function, which I guess I am, but I just want to call the constructor on parser::scanFile.
I'm new-ish to C++, so any help would be greatly appreciated.