Vectors

Hi,
i am trying to using vector. but is facing error. the error is"error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'void' (or there is no acceptable conversion)" the error line 6 and 7.

1
2
3
4
5
6
7
8
	vector <cher *> chers(2);

	chers[0] = new cher("1", " bb ", 10.00);
	chers[1] = new cher("2", " cc", 20.00);

	cout << chers[0]->displayVoucher() << endl;
	cout << chers[1]->displayVoucher() << endl;
Last edited on
What does displayVoucher return after the function call? I'm guessing that the return type is "void". You are trying to send the return value "void" to the operator<< which won't work. You have to return a value of some kind and there must be a version of operator<< that can handle that value (unless you define a version of it yourself).
tks. i check my displayVoucher function and realise that is also have a cout. i did some edit and it works. once again tks for the help.
Topic archived. No new replies allowed.