Initializing String Class Member at Creation

bor...@ix.netcom.com (David and Ann Borger ) wrote:

Quote
>I'm trying to construct what I thought was a very simple class but am
>getting a GP Fault at run time.  The class (still under development)
>looks like:
>interface
>type
>  TSupervisor = class
>  private
>    location : String;
>  public
>    constructor Create(path : String);
>    destructor Destroy;
>end;

- snip -

Quote
>In my main program I have
>..
>var
>  ms : TSupervisor;
>begin
>  ms.Create('c:\test');
>..
>end;
>And the GP Fault occurs where indicated above.  Any ideas?

Sure. The constructor is a function which allocates memory for and
returns a reference to the object being constructed. What you need is:

ms:=TSupervisor.Create('c:\test');

Steve Austin