[fpc-pascal] Adding method dynamically to a class

ik idokan at gmail.com
Tue Jun 19 15:29:03 CEST 2012


On Tue, Jun 19, 2012 at 4:13 PM, Mattias Gaertner <nc-gaertnma at netcologne.de
> wrote:

> **
>
>
> ik <idokan at gmail.com> hat am 19. Juni 2012 um 14:22 geschrieben:
>
>   Hello,
>
> Is there a way to tell in run-time that a specific function/procedure
> should belong to a class ?
>
> For example, let's say I have the following class:
>
> Type
>   TTest = class
>     procedure Foo;
>   end;
>
> And I have also:
>
> procedure Bar;
> ...
> end;
>
> Is there a way to make at some point of my code execution, that Bar will
> be a method of TTest ?
> Or maybe for a specific instance of TTest ?
>
>
>
> Do you mean that TTest.MethodAddress('bar') should return your Bar?
>

Yes, after "adding it" (glue) to the TTest class/instance.
Like with  some dynamic languages that allow you to create/attach methods
on run time.

 Yes.
>
>
>
> Mattias
>
>
>
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20120619/90c9afcc/attachment.html>


More information about the fpc-pascal mailing list