i was expecting enum to be treated as integer as using it in my code as,
for ( enumA i=0, i< enumMax ; i++)
Only after compiler scolding me, I realized that post-increment will not work with enum :-)
so here is how we can overcome this,
for ( enumA i=0, i< enumMax ; i = enumA( i+1))
And remember enum is a datatype and so operator overloading over an enum is not possible and hence you can not overload ++ operator also.
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment