Solved

Multiple destructors?

Posted on 1998-09-17
4
373 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi cmd execution 6 55
Virtuailstring tree compare node issue 14 105
Can Viruses spread while transferring Binary data with Winsock 2 66
Create a path if not exists 7 69
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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

910 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now