you did not code the class constructor or destructor.
Hmm..I don't think that makes a difference in this case since the object will be created irrespective of the initialization of the member variables and desctructors in such small programs are as such better left alone...
I am using this now:
void parseFile(ifstream& in) { string tmp; Opra_record rec; // = new Opra_record; while(!in.eof()) { in >> rec; } }
You forgot to incorporate the tips given to you.
And basically what you are doing is going in the wrong direction. You need not put the while loop in the parseint( ) function but in the overloaded friend function. Something like:
std::ifstream& operator>>(std::ifstream& in, Opra_record& r)
{
string temp ;
while( in >> temp )
{
// create accessor function for each private variable so that
// you can retrieve them later from any part of the program
r.get_string_data().push_back( temp ) ;
}
}
void parseFile(ifstream& in)
{
Opra_record rec = new Opra_record( );
in >> *rec;
}