I'm trying to make my own text based racing sim
but when I try to display the cars details I get an error.
I need to overload the operator << can someone help with that?
I tried several things but it just won't work
this is the error:
error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'void' (or there is no acceptable conversion)
Code:void Car::details() { int damage = m_Damage; int gas = m_Gas; int speed = m_Speed; int engine = m_Engine; cout << "Car details: \n"; cout << "Max Speed: " << speed << endl; cout << "Gas Level: " << gas << endl; cout << "Damage Level: " << damage << endl; cout << "Engine Power: " << engine << endl; } int main() { Car myCar; cout << myCar.details(); // this gives the problem return 0; }