[fpc-pascal] Adding method dynamically to a class
JC Chu
jcchu at acm.org
Tue Jun 19 15:39:08 CEST 2012
Depending on what you’re actually trying to do, you may consider
implementing your own invokable variant type. I found a tutorial at
http://alex.ciobanu.org/?p=152. Basically, instances will be wrapped
in a TVarData-compatible record, and your custom
TInvokeableVariantType-derived class will allow you to intercept
method calls.
On Tue, Jun 19, 2012 at 8:22 PM, ik <idokan at gmail.com> wrote:
> 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 ?
>
> Thanks,
>
> Ido
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
--
Best regards,
JC Chu
More information about the fpc-pascal
mailing list