×

Loading...

You should implement

your own Enumeration class as an inner class(non-static).
This inner class implements the interface Enumeration.
The beauty of the inner class lies in that this class has full access
to any private data members. Each time an object of the container
class is instantiated, the compiler will implicitly create an object of
this inner class, which is attached to the container class instance.
So in your Enumeration class constructor, you have full access to the
members of your container class instance(notice here that it's guranteed the container class object has been created).
So what you should do is just initilize the pointer in your inner class pointing to the first element in your container class object.
class has been created
Report