[fpc-pascal]ReAlloc Question

Michael Van Canneyt michael.vancanneyt at wisa.be
Fri May 16 16:29:17 CEST 2003


On Fri, 16 May 2003, James Mills wrote:

> On Fri, May 16, 2003 at 03:05:30PM +0200, Michael Van Canneyt wrote:
> >
> > > > I'll show you... Catch, datanicks.pas and nickclass.pas ...
> > > > This is why I need to understand and fix this, it's not just a simple
> > > > TStringList that I want to use :)
> > >
> > > Forgot to attach em :(
> >
> > It should work with this class too.
>
> Okay, thanks.
>
> btw ... Is this how you write classess properly ? (destroy destructor as
> you said ...)
>
> type
>    TTokenizer = class(TObject)
>       constructor init(tmpStr: String);
>       constructor init(tmpStr: String; tmpDelim: Char);
>       destructor destroy; override;
>
> .
> .
> .
>
> destructor TTokenizer.destroy;
> begin
>    inherited destroy;
> end;

This is OK. It's also customary to call the constructor 'Create'. It
reflects more what is happening, namely that *new* memory is allocated.
'Init' reflects more that *existing* memory is initialized.
(which is more an old TP construct)

Michael.





More information about the fpc-pascal mailing list