Einzelnen Beitrag anzeigen

Benutzerbild von Aphton
Aphton

Registriert seit: 31. Mai 2009
1.198 Beiträge
 
Turbo Delphi für Win32
 
#2

AW: Stored classes identified by integer - how to get type base on number?

  Alt 28. Nov 2011, 17:02
You could probably try this out (depending on your Delphi Version)

Delphi-Quellcode:
type
  TClassEnum = (ceFirstClass, ceAnotherClass{, ...}); // ...

  TBaseClass = class of TBase; // TBase is your base class (TFirstClass and TAnotherClass inherit from TBase!)

const
  cClassEnumTypes: Array[TClassEnum] of TBaseClass = (TFirstClass, TAnotherClass{, ...});

// AType: TClassEnum;
var
  Instance: TBase;
begin
  Instance := cClassEnum[AType].Create;
  Instance.LoadFromStream;
  {...}
end;
das Erkennen beginnt, wenn der Erkennende vom zu Erkennenden Abstand nimmt
MfG

Geändert von Aphton (28. Nov 2011 um 18:06 Uhr)
  Mit Zitat antworten Zitat