Moreover, [[C++11]] allows foreach loops to be applied to any class that provides the <code>begin</code> and <code>end</code> functions. It's then possible to write generator-like classes by overloadingdefining havingboth the iterable methods (<code>begin</code> functionand returning<code>end</code>) and the classiterator instancemethods itself(<code>operator!=</code>, <code>operator++</code> and having<code>operator*</code>) the class implementin the iteratorsame syntaxclass. For example, it is possible to write the following program: