[Lazarus] Are private data not allowed? Why?

Sven Barth pascaldragon at googlemail.com
Sun Nov 13 14:44:44 CET 2011


On 13.11.2011 01:46, Massimo Soricetti wrote:
> I would like an explanation on this code (noob question, maybe):
>
> private
> sDati: array[0..3] of string;
> procedure Verifica(var: sDati array of string);
>
> This code returns an error because sDati is already declared. If I move
> the declaration in public space is OK:
>
> private
> procedure Verifica(var: sDati array of string);
>
> public
> sDati: array[0..3] of string;
>
> why this? Private data are not allowed? Why?

In mode "objfpc" duplicate identifiers inside a class are not allowed, 
to reduce confusion when working with that class.

The interesting point is though: shouldn't your second example fail as 
well according to that logic?

Regards,
Sven





More information about the Lazarus mailing list