Simple question really, I just can’t seem to find an answer.
How do I go about counting how many objects are being used from a particular class? I was thinking of using a list and adding all the objects to a list and then counting the list… If I was to do that, how would I access that list?
If you are interested in how many instances of a class have been created, you can increment a static counter in its constructor(s).
Note that this code is not thread safe: you will need to add thread safety protections around the accesses to C.numInstances