void value not ignored as it ought to be

I am making a program with objects and inheritance. I am getting this error:
This was working fine until i changed it to use pointers to objects.

error: void value not ignored as it ought to be
*ptrvehicles[nextarraypos()]->setwheels(4);
^
from code in main.cpp:

ptrvehicles[nextarraypos()]= new Batmobile; *ptrvehicles[nextarraypos()]->setwheels(4); cout << *ptrvehicles[nextarraypos()]->getwheels() << endl;

in Vehicle class I declared the functions virtual (may not need this?)
virtual void setwheels(int w);
virtual int getwheels(void);

in Batmobile.cpp
void Batmobile::setwheels(int w){
Wheels=w;
}

in Batmobile.h
public:
int Batmobileness;
int getwheels(void);
void setwheels(int w);


I believe this sort of error is caused my expecting a return from void but i cannot see that I'm doing that.

Anyone see what I'm doing wrong to cause this error? Thanks in Advance.
Presumably nextarraypos()?
*ptrvehicles[nextarraypos()]->setwheels(4);
ptrvehicles is an array of pointers.
ptrvehicles[nextarraypos()] is a pointer
-> would dereference the pointer and call the setwheels() method
* try to dereference whatever setwheels() returns. But it returns void, hence the error.
Thankyou ne555, Removing the * did solve the problem and it makes sense now that you explained it like that. My brain can't handle pointers to pointers too well.
Topic archived. No new replies allowed.