ich baue gerade eine Objectklasse mit "TJSONObject" als ClassParent auf und frage mich nun, ob es möglich ist ein Object vom Typ "TJSONObject" in mein Object reinzukopieren, damit
mir die Daten zur Verfügung stehen, ohne dass mein Object überschrieben wird.
Bsp.:
Code: Alles auswählen
unit jsonSettings_BASE;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, fpjson;
type
{ TJSONSetting }
TJSONSetting = class(TJSONObject)
private
{Private Vars}
private
{Private Procedures}
public
{Public Vars}
public
{Public Procedures}
procedure CopyFromJSONObject(obj: TJSONObject);
(* CONSTRUCTOR *)
constructor Create;
constructor Create(const Elements: array of const); overload;
public
{Properties}
end;
implementation
{ TJSONSetting }
procedure TJSONSetting.CopyFromJSONObject(obj: TJSONObject);
begin
{Inhalt des Objectes vom Klassentyp der Parent-class kopieren, damit man es selber nutzen kann}
end;
constructor TJSONSetting.Create;
begin
inherited Create;
end;
constructor TJSONSetting.Create(const Elements: array of const);
begin
inherited Create(Elements);
end;
end.
Code: Alles auswählen
MyObject {TJSONSettings} :=AnJSONObject {TJSONObject};
Ich hoffe ihr könnt mir folgen

MfG
mark332
PS: Auf dem Gebiet bin ich noch ein ziemlicher Anfänger, ich bitte darum mich für peinliche oder dumme Fehler nicht zu lynchen
