Unless if I am not understanding the question, it seems like the easiest way is to have a static variable that you increment in the constructor. How about something like this?


class A {
...