On 20 Mar 01, at 17:52, Frank Heckenbach wrote:
That's the interesting case because h1 could (at runtime) be an f2.
If you "Constructed" it earlier with "h1 := f2.create;" instead of "h1 := f1.create;" then "h1 is f2" will also be TRUE. Also, if somewhere down the line you do "h1 := h2;" then "h1 is f2" will also be TRUE
Yes, that's what I mean.
(but you will get an exception when you come to free h1 unless you have overridden the destructor to cater for situations where "h1 is f2".
Doesn't Delphi support virtual destructors? Even BP does...
Yes, it does - but I am not sure which destructor you would be calling after such an assignment. Remember that instances of classes are pointers to the objects - so in the assignment, what you are moving around are pointers, and there may be gotchas there.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) Author of: Chief's Installer Pro for Win32 http://www.bigfoot.com/~African_Chief/chief32.htm Email: African_Chief@bigfoot.com