question about class design and overloading
Hello
I have a simple class in which I have int timeouts and some other data..
For instance:
Code:
class data {
public:
data() { }
int &timeouts() { return m_timeouts; }
//...and so on..
private:
int m_timeouts;
int m_some_other_data;
std::string m_somestr;
};
Now I dont only want to access timeouts but also to preform ++ operation on it (to increase it for 1)..
Now I wonder.. Would it be more sensible to make new function increase_timeouts() or overload operator ++ on class so that I could do:
data data_instance;
data_instance++;
This looks nicer but I wonder if you guys have any considerations regarding that kind of design since user might not know what ++ operator does..
What would you guys do?
Thanks for help again