Einzelnen Beitrag anzeigen

jsp

Registriert seit: 9. Aug 2003
50 Beiträge
 
#1

Abgeleitete Klasse korrekt aufrufen

  Alt 24. Okt 2018, 09:04
Delphi-Version: 10.2 Tokyo
Hallo zusammen,

ich habe folgende Klassen aus einem wsdl-Import:
Delphi-Quellcode:
  NPKChapter = class(TRemotable)
  private
    Fnumber: string;
    Fnumber_Specified: boolean;
    Ftitle: string;
    Ftitle_Specified: boolean;
    FreleaseYear: Integer;
    Fversion: Integer;
    Flanguage: TLanguage;
    Fstand: Integer;
    FsubNodes: ArrayOfNPKNode;
    FsubNodes_Specified: boolean;
    Fapplication_: ArrayOfNPKApplication;
    Fapplication__Specified: boolean;
    procedure Setnumber(Index: Integer; const Astring: string);
    function number_Specified(Index: Integer): boolean;
    procedure Settitle(Index: Integer; const Astring: string);
    function title_Specified(Index: Integer): boolean;
    procedure SetsubNodes(Index: Integer; const AArrayOfNPKNode: ArrayOfNPKNode);
    function subNodes_Specified(Index: Integer): boolean;
    procedure Setapplication_(Index: Integer; const AArrayOfNPKApplication: ArrayOfNPKApplication);
    function application__Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property number: string Index (IS_OPTN) read Fnumber write Setnumber stored number_Specified;
    property title: string Index (IS_OPTN) read Ftitle write Settitle stored title_Specified;
    property releaseYear: Integer read FreleaseYear write FreleaseYear;
    property version: Integer read Fversion write Fversion;
    property language: TLanguage read Flanguage write Flanguage;
    property stand: Integer read Fstand write Fstand;
    property subNodes: ArrayOfNPKNode Index (IS_OPTN) read FsubNodes write SetsubNodes stored subNodes_Specified;
    property application_: ArrayOfNPKApplication Index (IS_OPTN) read Fapplication_ write Setapplication_ stored application__Specified;
  end;
  
  NPKApplication = class(TRemotable)
  private
    Fnumber: string;
    Fnumber_Specified: boolean;
    Fdescription: string;
    Fdescription_Specified: boolean;
    FcontractRelevant: Boolean;
    procedure Setnumber(Index: Integer; const Astring: string);
    function number_Specified(Index: Integer): boolean;
    procedure Setdescription(Index: Integer; const Astring: string);
    function description_Specified(Index: Integer): boolean;
  published
    property number: string Index (IS_OPTN) read Fnumber write Setnumber stored number_Specified;
    property description: string Index (IS_OPTN) read Fdescription write Setdescription stored description_Specified;
    property contractRelevant: Boolean read FcontractRelevant write FcontractRelevant;
  end;
  
  NPKApplicationTitle = class(NPKApplication)
  private
    FsubNodes: ArrayOfNPKApplication;
    FsubNodes_Specified: boolean;
    procedure SetsubNodes(Index: Integer; const AArrayOfNPKApplication: ArrayOfNPKApplication);
    function subNodes_Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property subNodes: ArrayOfNPKApplication Index (IS_OPTN) read FsubNodes write SetsubNodes stored subNodes_Specified;
  end;
Aufrufen tue ich die abgeleiteten Klassen wie folgt:

Delphi-Quellcode:
  NPK_Chapter := NPKChapter.Create;
  NPK_ApplicationTitle := NPKApplicationTitle.Create;
  NPK_Application := NPKApplication.Create;

  // funktioniert wie erwartet
  NPK_Chapter := soapPartner.downloadNPK(numberStr, dispLanguage, year);
  
  // hier bin ich mir nicht sicher, ob ich die abgeleteten Klassen korrekt aufrufe
  NPK_Application := NPKApplication(NPK_Chapter);
  NPK_ApplicationTitle := NPKApplicationTitle(NPK_Application);
Ist der Aufruf korrekt so?

Gruss, Jörn
  Mit Zitat antworten Zitat