Tag: oop
DeHL 2.2 Released
In this release I have changed the name of the library from DelphiHelperLib to DeHL to be shorter. The most important changes in this release are: Renamed the library to DeHL in hopes to remove the length of…
Read More »How To: Creating a custom Variant type
In this post I will detail on how to create a custom Variant for your data type. First of all, the help should be pretty useful in this case, but it if doesn’t help much, there is always…
Read More »Delphi Generics: constructor restriction
As promised in the previous post “Delphi: Default parameterless constructor” I will now try to create a new generic class that accepts a type parameter that has a “constructor” restriction (must have a default public parameterless constructor). Let’s…
Read More »Delphi: Default parameterless constructor
A weird consequence of Delphi’s OOP behavior is how constructors are handled, and in particular how the default parameterless constructor is handled. Consider the following example: [Delphi] type TMyClass = class end; var Obj: TMyClass; begin Obj :=…
Read More »Abstract methods (or “why not”)
I always considered the implementation of abstract methods in Delphi to be a hack, mostly because there is no way (or is there?) to treat this: “[DCC Warning] W1020 Constructing instance of a class containing abstract method.” warning…
Read More »Overridden method should match case of ancestor
I’ve been following CodeRage III these days and presenter mentioned that in Delphi 7 (and above), when overriding virtual methods, the same case should be used for both functions. Consider this example: In this case indeed the compiler…
Read More »