Delphi Gem of the day: putting “reintroduce” on a destructor. destructor…
Posted by jpluimers on 2020/09/22
A nice thread with examples of all the things you should not do with the Delphi reintroduce
keyword:
[WayBack] Delphi Gem of the day: putting “reintroduce” on a destructor. destructor Destroy(); reintroduce; overload;
In our case all we got was a memory lea… – Moz Le – Google+
The problem is that in the original (archived) documentation, not much waring is given around using reintroduce
; it is merely posted as solving a nuisance to absolve a compiler warning.
When using it though, all your alarm systems should go off at their highest level as you break polymorphism, but through careful language usage, the pattern you hide can still be used.
One day I will write a longer blog article on this.
Documentation:
- [WayBack] W1010: Method ‘%s’ hides virtual method of base type ‘%s’ (Delphi)
- [WayBack] Methods
- [WayBack] Fundamental Syntactic Elements
A decade of progress has not changed much on this documentation apart from some nicer formatting:
- [WayBack] W1010 Method ‘%s’ hides virtual method of base type ‘%s’ (Delphi) – RAD Studio
- [WayBack] Methods (Delphi) – RAD Studio
–jeroen
Leave a Reply