Can a class maintain a shared collection of its own instances
Posted on 2006-03-24
Can a class (say Person) maintain a shared collection of instances of all Person objects created (maybe an array called Persons).
i.e. Whenever a Person instance is created, it adds itself to the Persons collection which is a shared member and accessible to all of the created person instances?
I wonder if you could do it as part of the constructor, but the instance doesnt exist at that point....
Hope this makes sense.