Introduction to OOP | Chapter 23: Object Interconnections : | next | previous | audio | real | text |
class AcontainerClass { ... // return an enumerator public Enumeration elements() { return new MyEnumeration(); } ... // inner class is allowed to see // all aspects of surrounding class private class MyEnumeration implements Enumeration { ... public boolean hasMoreElements () { ... } public Object nextElement() { ... } } }Uses a lot for event listeners in Java, among other things.