Static polymorphism in Delphi

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

+3
source share
2 answers

Static polymorphism is not possible in Delphi; generics are not templates. Unlike templates, generics are parsed at the time of declaration, not at creation time. This is why a compiled module (* .dcu) should only contain an AST representation of a common object, while creating an AST from an uninformed C ++ template declaration is almost impossible.

+6
source

From Delphi 2009 there are generics. In combination with class or interface constraints, you can use them to implement static polymophism.

, Delphi 2009 , Delphi 2010 ( , , , D2010)

+3

Source: https://habr.com/ru/post/1717241/


All Articles