On Mon, 29 Jan 2024, Amir--- via fpc-pascal wrote:
I am still struggling with this! for i := 0 to vft^.Count - 1 do begin vfe := vft^.Field[i]; Name := vfe^.Name; ChildTClass := vft^.ClassTab^.ClassRef[vfe^.TypeIndex - 1]^; ChildObj := ChildTClass.Create; TObject(Obj.FieldAddress(Name)^) := ChildObj; end;Looks like "ChildTClass.ClassName" is correct but the constructor of the appropriate class is not being called.
Without more info (declaration of ChildTClass, declaration of the constructor of that class etc), it is not possible to comment. We need a complete compilable code sample to provide you with more insight. Michael.
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal