Re: calling different functions but using one name; or assigning a function t...
From: VBDis (vbdis_at_aol.com)
Date: 10/07/04
- Next message: VBDis: "Re: D7 Compiler Bug"
- Previous message: Endy: "Pointer as interface"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 07 Oct 2004 10:59:20 GMT
Im Artikel <2sis07F1ksgnoU1@uni-berlin.de>, "Allan M. Due" <me@privacy.net>
schreibt:
>What I would like is to have
>
>if (condition1) algo := old_algo else algo:=new_algo;
Place that decision into the function itself, and add your new code there.
For a static replacement (at compile time) you can use {$IF ...}, or a const
for condition1 so that the compiler can eliminate the dead code in the never
choosen branch.
The other solutions with procedure pointers and overloading have already been
mentioned otherwhere. Overloading also makes a static selection, at compile
time, whereas procedure or method pointers can be changed at runtime.
DoDi
- Next message: VBDis: "Re: D7 Compiler Bug"
- Previous message: Endy: "Pointer as interface"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|