I'm a CS alumni, but we didn't learn much by the way of OOP, or Design Patterns. I've heard the phrase C with iostreams and thought it fitting. Anyway that's besides the point. I am just curious about what I perceive would be a very simple design pattern.
Have any of you played the game Starcraft? You know how you can select/deselect units? Back to that in a second. Suppose I have a Unit class, and I wanted it to keep track of all the units that were selected. I had the idea that I could create a static list/arrray inside the Unit class, and the units themselves could add or remove themselves from the array as they were selected/deselected.
That's just one example, there could be other applications of this "pattern". Say you wanted to maintain a list of visible "tabs" in a web browser or w/e, you could have them add a reference to themselves in a a static array in the class.
The idea is that you could just call Unit.GetSelected() and get a pointer/reference to all of the "selected" or "opened" units/tabs. I am aware that there are other maybe better ways of solving these problems, but that is also besides the point. What would this pattern be called?