Explicit value constructor problem

I am having an issue with my explicit value constructor. It won't let me input items from a file to the an array in it. I am getting this error " error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'call_record' (or there is no acceptable conversion)". It is occurring at "input>>call_DB[count++];".

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 
CALLS::CALLS(const string & filename, const int size) 
{
	cout<<"Explicit-value constructor has been called\n";

	ifstream input;

	CAPACITY = size;
	call_DB = new call_record[size];
	count = size;

	input.open(filename.c_str());

	for(int i=0; i<count;i++)
	{
		input>>call_DB[count++];
	}
	input.close();
} 





You haven't defined any way to load things from an ifstream to a call_record. You'll need to overload operator >> to let your code work.
The problem is exactly what it says. You're trying to use the operator >> to read data into an object of type call_record, but the compiler doesn't know how to do that. You will have to write it yourself.
Topic archived. No new replies allowed.