= Iterator = == Description == The [wiki:Iterator] allows you to easily iterate through all objects in an [wiki:ObjectList]. An [wiki:ObjectList] stores all objects of a given class (and all derivatives). To start iterating, you need the first element in the [wiki:ObjectList]. This gets returned by !ObjectList::begin(). == Example == The following example uses the class-tree below. {{{ #!cpp new A1(); new A1(); new A1(); new A3(); new A3B1(); new A3B1C1(); int count = 0; for (Iterator it = ObjectList::begin(); it; ++it) count++; std::cout << "BaseObject: " << count << std::endl; count = 0; for (Iterator it = ObjectList::begin(); it; ++it) count++; std::cout << "A1: " << count << std::endl; count = 0; for (Iterator it = ObjectList::begin(); it; ++it) count++; std::cout << "A3B1: " << count << std::endl; /* return: BaseObject: 6 A1: 3 A3B1: 2 */ }}} [[Image(Core:testclass_tree.gif)]]