#include <iostream> using namespace std; class Actor { private: int health; int atkPower; public: Actor() { health = 100; atkPower = 10; } int getHealth() { return health; } void setHealth(int val) { health = val; } }; int main() { Actor player; Actor enemy; while (enemy.getHealth <<= 0) { } return 0; } The while loop is the error. How can I use the return value of the function for that loop without getting an error? Also is it possible if someone could explain to me why exactly this code isn't acceptable to the compiler? Thank you in advance.