使用dynamic_cast转换问题!
帮忙看看是什么问题:
#include <iostream>#include <fstream>#include <string>using namespace std;void write(ostream &file){ ofstream &file1=dynamic_cast<ofstream&>(file); file1.put('a');}int main(){ string filename; cin>>filename; ofstream ifile; ifile.open(filename.c_str(),ofstream::app); write(ifile); ifile.close(); ifile.clear(); return 0; }