Board index » cppbuilder » destructor

destructor


2005-04-05 03:47:46 PM
cppbuilder13
Hi all,
I created an application that loads a dll in the constructor and I wish to
unload this dll in the destructor after using it.
When I write the code below, I get an error "VCL class need virtual
destructor"
What does that mean ?
if I add "virtual" before the declaration of the destructor, others errors
occurs concerning the parameter Sender (what is it utility ?) and virtual.
I have solved the trouble by unloading the dll with the event FormDestroy
but I still don't understand why I can't write my own destructor.
Thanks for your help.
Montin
class TForm1 : public TForm
{
__published:
private:
public:
__fastcall TForm1(TComponent* Owner);
__fastcall ~TForm1(TComponent* Owner); // ERROR !!!!!!
};
 
 

Re:destructor

Dominique MONTIN wrote:
Quote
When I write the code below, I get an error "VCL class need virtual
destructor"
What does that mean ?
if I add "virtual" before the declaration of the destructor, others
errors occurs concerning the parameter Sender (what is it utility ?)
and virtual.
Questions on using VCL components should be asked in
.vcl.components.using. If you don't get a useful reply here in the next
couple of days please repost.
--
Andrue Cope [TeamB]
[Bicester, Uk]
info.borland.com/newsgroups/guide.html
 

Re:destructor

Dominique MONTIN wrote:
Quote
__fastcall ~TForm1(TComponent* Owner); // ERROR !!!!!!
The destructor never takes any arguments. Try with
__fastcall ~TForm1();
Ivan Johansen
 

{smallsort}

Re:destructor

Thanks.
It was the mistake: destructor must not have any argument ( I guess it's a
classical beginner error)
"Ivan Johansen" < XXXX@XXXXX.COM >a écrit dans le message de
Quote
Dominique MONTIN wrote:
>__fastcall ~TForm1(TComponent* Owner); // ERROR !!!!!!

The destructor never takes any arguments. Try with
__fastcall ~TForm1();


Ivan Johansen
 

Re:destructor

Dominique MONTIN wrote:
Quote
It was the mistake: destructor must not have any argument ( I guess
it's a classical beginner error)
Yes, easy to make. BTW:My apologies for not apparently posting that but
I seem to be suffering posting issues. Hopefully my IT guys can sort me
out :-/
--
Andrue Cope [TeamB]
[Bicester, Uk]
info.borland.com/newsgroups/guide.html