Is this intended behavior?

Jacob Carlborg doobnet at gmail.com
Sun Aug 10 05:24:48 PDT 2008


Is this intended behavior?

class id
{
     public int id;

     public this ()
     {
     }

     public this (int id)
     {
         this.id = id;
     }
}

class NSObject : id
{
     public this ()
     {
     }

     public this (int id)
     {
         this.id = id;
     }

     id foo () // error here
     {
         return new id(3);
     }
}

The compiler says: "Error: id is used as a type"
using the gdc bundle from the tango website on osx.
Apparently the compiler thinks the return type "id" refers to the member 
variable instead of the class.



More information about the Digitalmars-d mailing list