When is it bad to make the return type of a method its own class? for example:
class Stuff{
public:
Stuff &change_name(std::string name) {...} // is this better,
void change_name(std::sring name) {...} // than this?
};
Is it better to make change_x
return Stuff
or just make it void
? because I don't really see a reason why someone will make a sequence of command when calling the method change_name
, or is it may be a good practice to always return a supposed to be void
method to return its class?