Class Of Cast



Casting Class of type
Smart pascal source code
type TBaseTemplate = class class procedure Execute; end; type TSubTemplate = class(TBaseTemplate); type TBaseTemplateClass = class of TBaseTemplate; procedure Foo(FooClass: TBaseTemplateClass); begin WriteLn(FooClass.ClassName); end; class procedure TBaseTemplate.Execute; begin Foo(ClassType as TBaseTemplateClass); Foo(TBaseTemplateClass(ClassType)); end; { main.pas } Begin TBaseTemplate.Execute; TSubTemplate.Execute; { ### CONSOLE OUTPUTS ### TBaseTemplate TBaseTemplate TSubTemplate TSubTemplate }