Whenever possible, getters and setters should be avoided. Arguments:
- The setter and the getter are essentially the same as referring to members of a class, only the more ugly way of doing so.
- To construct an object with specific properties, use constructors with initialization lists. And an overload of constructors for argument types.
- Classes need to be designed so that their member functions perform meaningful actions. And to reduce them to the level of setters-getters, for sure, is not necessary.
Plus, there are only one getters and setters - with their total use, it is possible to log calls to variables. Those. debugging might be easier. But, given that it is still possible to directly access variables, it will be tempting to use one method or the other.
Regarding the question "what's better?"
It seems to me that the getValue / setValue option is better than any other (get_ / put_, ValueGet / ValueSet, etc.). Better yet, abandon get / set and call accessors by data name. For example:
class my { private: int size_; ... public: int size(void) {return size_;} void size(int s) {size_ = s;}//хотя зачем? тут еще должна быть куча логики // так что лучше ввести ф-цию resize(int) ;) ... }
PS: and the names of classes (types) are also besy with the letter T. Why? See here
PPS: I also found an interesting variant of naming in Qt :