Solved

Multiple destructors?

Posted on 1998-09-17
4
389 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses
Course of the Month6 days, left to enroll

626 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