C
cppaddict
I would like to write, within the private section of my class
definition:
static enum TruncType {TRUNC_TOP,TRUNC_RIGHT,TRUNC_BOTTOM,TRUNC_LEFT};
but C++ does not allow this. The four values above are constant and
static, and will be used only by a private class method.
I could just do:
static const int TRUNC_TOP;
static const int TRUNC_RIGHT;
etc...
initializing them to distinct values in my .cpp file.
But it would be nicer to use an enum, or somehting else specifically
suited to this purpose. What is the best way to what I'm trying to
do? Ie, declare four static class constants whose values are
irrelevant except as distinguishing markers.
Thanks,
cpp
definition:
static enum TruncType {TRUNC_TOP,TRUNC_RIGHT,TRUNC_BOTTOM,TRUNC_LEFT};
but C++ does not allow this. The four values above are constant and
static, and will be used only by a private class method.
I could just do:
static const int TRUNC_TOP;
static const int TRUNC_RIGHT;
etc...
initializing them to distinct values in my .cpp file.
But it would be nicer to use an enum, or somehting else specifically
suited to this purpose. What is the best way to what I'm trying to
do? Ie, declare four static class constants whose values are
irrelevant except as distinguishing markers.
Thanks,
cpp