[fpc-devel] Nested Classes used as Namespace Question

Andrew Brunner andrew.t.brunner at gmail.com
Sun Jan 9 19:47:18 CET 2011


  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;

I'm trying to have identical naming conventions and kind of expected
these classes to have some degree of isolation within nests.
NS_SPACE2.Properties.Name is not valid b/c the compiler has Name
already defined above in NS_SPACE1.  Is this expected?  Is it too much
work to isolate nested classes so I can get past this error?  Is there
another way to achieve having two "Properties" type with two different
types with no exceptions?

Thanks in advance.



More information about the fpc-devel mailing list