Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Konstante: Array of Class (https://www.delphipraxis.net/184719-konstante-array-class.html)

Der schöne Günther 16. Apr 2015 17:35

Delphi-Version: XE7

Konstante: Array of Class
 
Ich stehe grade auf dem Schlauch:

Warum geht die dritte Konstante nicht? Was ist daran nicht konstant?

Delphi-Quellcode:
program Project27;

const
   affectedNumbers:   TArray<Integer>   = [42, 99, -12];
   affectedInstances:   TArray<TObject>   = [nil];
   affectedClasses:   TArray<TClass>   = [TInterfacedObject];
      // E2026 Konstantenausdruck erwartet
begin
   //
end.

Uwe Raabe 16. Apr 2015 17:51

AW: Konstante: Array of Class
 
Dasselbe hättest du auch bei
Delphi-Quellcode:
TArray<TObject>
. Dort, wie bei
Delphi-Quellcode:
TArray<TClass>
, geht nur
Delphi-Quellcode:
nil
als Konstante.

Der schöne Günther 16. Apr 2015 17:58

AW: Konstante: Array of Class
 
Oh, hoppla stimmt :oops:

Aber warum das nicht gehen soll verstehe ich noch nicht.


Alle Zeitangaben in WEZ +1. Es ist jetzt 12:39 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz