我在以下代码中发现一个声明语法错误:
class fileio; //ERROR HERE: I'm trying to declare it so I can use it in read() function
int read(char* file_1); //File Read Function
文件IO。清洁石油产品
int read(char* file_1) { //File Read Function
fileio Object_1;
int records_read=0;
ifstream fin;
fin.open(file_1, ios::binary); //Opens the file again
while(fin.read((char*)& Object_1, sizeof(Object_1))) {
records_read++;
Object_1.show_tablular();
}
fin.close();
return records_read;
}
测验清洁石油产品
template <class T>
void AddColumn(T data, const int& width) {
cout<<setw(width)<<data<<" | ";
}
void Test_Class::show_tablular() {
cout<<endl; AddColumn(record_id,7); AddColumn(char_member, 20); AddColumn(int_member, 11); AddColumn(float_member, 13);
}
class fileio : public Test_Class { //Trying to relate the 2 classes
public:
void show_tablular() {
Test_Class::show_tablular();
}
};
我不明白为什么会这样。。。