On Sat, 28 Nov 2009 15:07:42 +0100
Mattias Gaertner <nc-gaert...@netcologne.de> wrote:

> On Sat, 28 Nov 2009 14:58:26 +0100
> Jürgen Hestermann <juergen.hesterm...@gmx.de> wrote:
> 
> > > is it possible to set a variable in a programm as a readonly variable?

> Use the following:
> 
> property MyVar: integer read FMyVar write SetMyVar;
> 
> And in SetMyVar you can set flag and raise an exception if set for the
> second time.

If the value is known in advance and if no runtime alteration of the
variable is allowed you would of course declare the value as const
rather than var. But this may not fit your case?

Howard
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to