Suppose I have a state in a program that stores the information of a user, and the platform I am on is not stateless (say a C++ or .NET desktop application).
class UserInfo
{
private:
std::string name_;
std::string accountID_;
}
Say the user logs out, in general, what are the best practices for state reinitialization?
- Write and Call a Reset() function on UserInfo and set all the variables to blank
- Delete UserInfo, create a new instance to store the new user.
Just to clarify, I am only using the UserInfo as an example; this could apply to things like an entire dialog or subsystems.