[fpc-devel] Nested Classes used as Namespace Question
Paul Ishenin
webpirat at mail.ru
Mon Jan 10 05:15:52 CET 2011
10.01.2011 1:47, Andrew Brunner wrote:
> Type
> NS_APP=class
> const
> const1=2;
> const3=5;
> type
> NS_SPACE1=class
> type
> Properties=(Name,Value);
> TMyRecord=record
> ID : integer;
> Name:string;
> Value:string;
> end;
> end;
> NS_SPACE2=class
> type
> Properties=(Name,Value); // Duplicate Identifer "Name"
> error @ compile
> TMyRecord=record
> Key : Array[0..1] of Byte;
> Value : Pointer;
> end;
> end;
> end;
This is by design. Enumeration members are added both to the unit and
enumration symbol table and therefore can't have equal names. If you
want to prevent adding them to the unit symbol table use {$SCOPEDENUMS
ON} directive. Then you will need to access them using prefixes only.
Like NS_APP.NS_SPACE1.Properties.Name.
Best regards,
Paul Ishenin
More information about the fpc-devel
mailing list