Multi-Class Class Helpers

This is cool. I figured out a way to assign the same class helper to multiple classes in Delphi 2007. Marco Cantu asked me if I knew how to do this during CodeRage II, and then David I. mentioned that Class Helpers should be used to implement Aspect Orientated Programming (AOP), but since they don’t support assigning the same class helpers to multiple classes that wouldn’t work.

I’ll write this up later. It isn’t a best case scenario, and requires a few extra lines of code, but it accomplishes what I set out to do, and that is pretty dang cool! Hopefully later CodeGear will extend class helpers and make this and other cool stuff easier. . .

Tags: , , ,

4 Responses to “Multi-Class Class Helpers”

  1. Li Yang says:

    Surprise to hear that this is possible :-) Wonderful. I thought that only those VM-ed language or scripts could do it well.

  2. william says:

    Class helper for TObject?

  3. Jim McKeeth says:

    A class helper for TObject or any other common descendant would work, but I figured out a way to assign it to only the specific objects you want, without adding it to the other objects. Although it does have some limitations I am trying to work around. May not be as useful as I originally thought. I’ll keep you posted.

  4. Denis says:

    Any advance on this?
    Also, do you have some pointers on how (multiple) class helpers can be used for AoP? I suppose it’s related to the “override-even-if-not-virtual” feature of class helpers.

Leave a Reply