On Sun, Jan 11, 2009 at 12:04 PM, Tim M <a...@b.com> wrote: > On Sun, 11 Jan 2009 15:59:26 +1300, Tim M <a...@b.com> wrote: >> Why does it still work for some objects? > > > This works: > > > module test; > > class A > { > this() > { > // > } > } > > class B > { > this() > { > // > } > int opApply (int delegate (inout B) dg) > { > return 1; > } > } > > void main() > { > A a; > B b; > foreach(a; b) > { > // > } > }
Interesting. But there the inner 'a' is actually a B. So it compiles, but there's no way it's using the outer 'a' as the counter variable. --bb