[fpc-pascal]create and destroy

Carlo Kok ck at carlo-kok.com
Mon Dec 17 11:28:53 CET 2001


----- Original Message -----
From: "Shifted Soul" <snsii at yahoo.fr>
To: "fpc mailing list" <fpc-pascal at deadlock.et.tudelft.nl>
Sent: Monday, December 17, 2001 10:01 AM
Subject: [fpc-pascal]create and destroy


> Hello, I have two small questions, if you can give me a yes or no only.
> Q1 : Can I call a method from the constructor of the same class. Example
> :
> TSample = CLASS
>                   PUBLIC
>                   CONSTRUCTOR Create;
>                   DESTRUCTOR Destroy;Override;
>                   PROCEDURE a;
> END;
>
> CONSTRUCTOR TSample.Create;
> BEGIN
>    a;
> END;

Yes, as far as I know, you can.

>
> Q2 : I know that the standard is to override the "destroy" destructor
> and to use the free method to dstroy the object. I know also that the
> standard "destroy" don't have any parameter. But I want to have a
> destructor with parameters, can I do it without being out of standard,
> don't tell me that I can call the destructor directly, because I gave a
> sample a time ago with a direct call to the destructor which made a
> great deal about standards, so I won't to make more troubles in this
> mailing list.

I don't know where you need it for, but why don't you create some properties
or variables like:
DoSomethingOnDestroy: Boolean;





More information about the fpc-pascal mailing list