Search code examples
delphidelphi-2009delphi-2010

Static polymorphism in Delphi


Is there a way to implement static polymorphism in Delphi 2010?


Solution

  • Static polymorphism isn't possible in Delphi; generics aren't templates. Unlike templates, generics are parsed at declaration time, not at instantiation time. That is why a compiled module (*.dcu) only needs to contain an AST representation of the generic entity, whereas building an AST from an uninstantiated C++ template declaration is nearly impossible.