J
jalina
Hello,
I want to have classes that all have a unique identifier. It is easy for
a single class:
class A {
static int index;
int my_index;
A(): my_index(index++) { }
};
But if you have something like:
class B: public A {
B() //....
}
class C: public A {
C() //....
}
the "index" is shared among A, B and C's. How can I do to have different
index for each distinct class without having to redefine each time a new
index ?
Thank you from Jalina
I want to have classes that all have a unique identifier. It is easy for
a single class:
class A {
static int index;
int my_index;
A(): my_index(index++) { }
};
But if you have something like:
class B: public A {
B() //....
}
class C: public A {
C() //....
}
the "index" is shared among A, B and C's. How can I do to have different
index for each distinct class without having to redefine each time a new
index ?
Thank you from Jalina