I can't seem to increment/decrement an object's hitpoints in a game. For example...
Any help is appreciated.Code:#include <iostream> class Player { public: int getHitPoints() const { return HitPoints; } void setHitPoints(int hit) { HitPoints = hit; } private: int HitPoints; }; int main() { using namespace std; Player Bob; Bob.setHitPoints(10); cout << "Bob gets hit!" << Bob.getHitPoints() - 2 << endl; return 0; }