I'm a beginner in c++ with some Java background. I came cross this piece of sample code
class simple_cbuf {
public:
enum { default_size = 100; };
explicit simple_cbuf(size_t size =
default_size);
~simple_cbuf();
size_t size() const;
bool empty() const;
int top() const; /* see below */
void pop();
void push(int new_value);
private:
/* whatever you want */
};
It seems to me that this code is using a public enum to hold the default size of the buffer. Is it a common practice in c++? In Java I would make this a "private static final int" constant