Reputation: 351
Is there some function which takes object as an argument and return the instance number of the object?
By instance number I mean:
The first instance of the class has instance number 1, the second has 2 and so on.
Upvotes: 0
Views: 481
Reputation: 467
In this case you can initialize a private static counter and in object constructor increment it.
Upvotes: 3