You have two same functions in class
class Object { protected: enum ID {OBJECT, CAVE, MONSTER, WUMPUS, HERO, GUN, BAT}; //maybe it better place outside the class? Coordinates* _my_coordinates; void id(ID id) //first declaration { this->_my_id = id; } public: explicit Object(s_int coordinate_x = 0, s_int coordinate_y = 0); virtual void move(Direction, u_int distance = 1) = 0; ID getId() const //redeclaration(renamed) { return _my_id; } const Coordinates* location() const { return _my_coordinates; } virtual ~Object(void); private: ID _my_id; };
this is a reformed code
Use get- and set- methods, like setId(), and getId()
unfortunately, that is completely preference, many people use function overloading for their respective getters and setters
void RandomObject::Value(int newValue) { _value = newValue; } //setter
int RandomObject::Value() { return _value; } //getter
this is entirely correct. Note the different function signatures? There's no problem with how that is set up. BUT, if you did feel like making the switch to the explicit get-set functions, don't forget to change the setter too ;)
~J