How to change delphi getter / setter property with RTTI?

I would like to replace getter / setter for properties with RTTI.

I know that you can access the getter device using TPropInfo.SetProc / GetProc, and I know that these fields point to different data if the property uses virtual methods, direct access to fields or static methods.

I am interested in changing setters / getters that point to virtual methods using custom virtual methods.

TRttiInstanceProperty(RttiProperty).PropInfo^.SetProc := ? // SomeOtherInstance.Setter
TRttiInstanceProperty(RttiProperty).PropInfo^.GetProc := ? // SomeOtherInstance.Getter
+4
source share
1 answer

, . RTTI /, . , RTTI . / .

, canonical read only:

property Count: Integer read GetCount;

RTTI, , getter. , :

Writeln(Obj.Count);

:

Writeln(Obj.GetCount);

. RTTI . RTTI , .

.

+4

Source: https://habr.com/ru/post/1526703/


All Articles