AOP support in Delphi

后端 未结 3 497
旧巷少年郎
旧巷少年郎 2020-12-28 19:58

Is it possible to do Aspect Oriented Programming in Delphi? I would be interested in native support as well as third party solutions.

I don\'t have a specific proble

3条回答
  •  一整个雨季
    2020-12-28 20:45

    ClassHelpers in the later versions of Delphi allow some very limited level of AOP type behavior. You can use ClassHelpers to inject behavior into other classes without descending from them. It allows overriding existing methods and then optionally calling that existing method.

    The limitation is you must declare a ClassHelper for a specific class and it descendants. Additionally a class can only have one ClassHelper.

    These are similar to Extension methods in C#.

提交回复
热议问题