[fpc-pascal] Initialize the object (not class)
Jonas Maebe
jonas.maebe at elis.ugent.be
Sun Jul 18 21:20:48 CEST 2010
On 18 Jul 2010, at 21:01, Zaher Dirkey wrote:
> MyObject = object
> private
> FProp1: integer;
> public
> Prop1: integer read FProp1 write FProp1
> procedure Proc1;
> end;
>
> used like
> var
> O: MyObject;
> begin
> O.Proc1;
> end;
>
> 1 - The problem, i have random value in the prop1(I am not sure about it),
> is that mean i must initiliaze it.
That's correct. An object is basically the same as a record, except that it can have methods (although in later Delphi versions, records also can have methods).
> 2 - is there a method i can override it to init my properties without to
> call it manualy O.init;
No.
Jonas
More information about the fpc-pascal
mailing list