Registriert seit: 31. Mai 2009
1.198 Beiträge
Turbo Delphi für Win32
|
AW: Stored classes identified by integer - how to get type base on number?
28. Nov 2011, 18: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 19:06 Uhr)
|