Solved

Multiple destructors?

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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
Delphi TcxGrid group footer summary 3 358
Why can't I create any project with my delphi EXE file? 6 45
JAudiorecorder record freezing the app 29 83
CheckListBox usage 3 81
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

756 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