The Art of Delphi Programming – In Part 2 of this series we learned about a more flexible implementation of the Visitor Pattern that the traditional approach. But we can do better. When we have a usual class inheritance within our shape or whatever classes, it might be desirable to handle groups of classes with a common ancestor all the same. For now we have to implement each interface individually. A slight change does the trick. We introduce a visitor interface for TAbstractShape, make TAbstractShape.Accept not abstract. Then we change the Accept implementations of the derived shapes to first check the visitor ...
Visits by Source
Users who voted for this posting