[fpc-pascal] with in classes/records

Benito van der Zander benito at benibela.de
Tue Sep 25 20:14:17 CEST 2018


Hi,

perhaps everything would be clearer, if the default property was 
accessed with ^  ?


var
	wrapper: TWrapper;
begin
	wrapper := TWrapper.Create;
	wrapper^ := THelperA.Create;
end.


Cheers,
Benito



Am 14.09.2018 um 10:50 schrieb Ryan Joseph:
> How should this syntax work? TWrapper needs to allow assignments of TWrapper for constructors but it also should accept assignments of THelperA for the default write property.
>
> Is that a problem or should TWrapper be able to assign both? It looks strange so I thought I would ask.
>
> ==========================================
>
> type
> 	THelperA = class
> 	end;
>
> type
> 	TWrapper = class
> 		objA: THelperA;
> 		property helperA: THelperA read objA write objA; default;
> 	end;
>
> var
> 	wrapper: TWrapper;
> begin
> 	wrapper := TWrapper.Create;
> 	wrapper := THelperA.Create;
> end.
>
> Regards,
> 	Ryan Joseph
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180925/042ccd23/attachment.html>


More information about the fpc-pascal mailing list