Array of MetaClasses



Array of MetaClass
Smart pascal source code
type TFoo = class end; type TBar = class end; procedure Test(t: array of TClass); begin Writeln(t.Length); for var c in t do Writeln(c.ClassName); end; { main.pas } begin Test([]); Test([TObject]); Test([TFoo]); Test([TFoo, TBar]); Test([TFoo, TObject]); Test([TObject, TFoo]); Test([TBar, TObject, TFoo]); { CONSOLE OUTPUT 0 1 TObject 1 TFoo 2 TFoo TBar 2 TFoo TObject 2 TObject TFoo 3 TBar TObject TFoo }