I was wondering how you would make a class where you create several instances i.e
Session o1 = new Session();
Session o2 = new Session();
You could then make these sessions the active session like so.
o1.makeActiveSession();
Session::setActiveSession(o2);
Then at any point in my code I could go:
Session::getActiveSession();
and it would return the active session object or create new one if one doesn't exist. Only one session can be the active session at any one time, so if a session is told to become the active session then the old one is deactivated.
So my question is, how would I make something like this ?