How do I override methods of nested types?
Posted
by Mason Wheeler
on Stack Overflow
See other posts from Stack Overflow
or by Mason Wheeler
Published on 2008-12-14T19:40:24Z
Indexed on
2010/04/04
17:43 UTC
Read the original article
Hit count: 223
I've got a custom TObjectList descendant in Delphi 2009, and I'd like to play with its enumerator a bit and add some filtering functionality to the MoveNext method, to cause it to skip certain objects. MoveNext is called by DoMoveNext, which is a virtual method, so this shouldn't be difficult to override... except for one thing. The TEnumerator for TObjectList isn't its own class; it's declared as a nested type within the TObjectList declaration.
Is there any simple way to override TEnumerator.DoMoveNext in my descendant class, or do I have to reimplement the whole TEnumerator? It's not a very big class, but I'd prefer to keep redundancies to a minimum if I can...
© Stack Overflow or respective owner