Solved

Multiple destructors?

Posted on 1998-09-17
4
377 Views
Last Modified: 2010-05-18
I have a number of destuctors in one form that I call depending on the constructor I use:

     destructor DestroyRepSpds;
     destructor DestroyRuleSpds;
     destructor DestroyDefs;

I just found out on this forum that I need to add override, when I do I get a compiler error message saying Method 'DestroyRepSpds' not found in base class.

Is it wrong to have multiple destructors?

Thanks, Tom.

0
Comment
Question by:tomcorcoran
  • 2
4 Comments
 
LVL 1

Expert Comment

by:pjdb
ID: 1340066
override is needed only if the parent class have the same method. In you case, the parent class does not have the DestroyRepSpds method some there is nothing to override.

JDB
0
 

Author Comment

by:tomcorcoran
ID: 1340067
JDB,

Thanks, makes sense, give an answer, so I can grade.

Tom.
0
 
LVL 1

Expert Comment

by:Marcius
ID: 1340068
You should also make sure that you call inherited destroy, I think. Otherwise the memory may not be cleared correctly. I am not sure about this, since I can't remember if the procedure being declared as destructor makes sure that inherited destroy is called.

Just a thought.
0
 
LVL 1

Accepted Solution

by:
pjdb earned 50 total points
ID: 1340069
Marcius is right, but i've assume that Tom already know it ;-)
In fact any time you write a message handler and a method that override a parent's method you are hardy advise to call the method inherited frrom the parent in order to pocess the message correctly.

JDB
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question