Yet a new properties proposal

Dimitar Kolev DimitarRosenovKolev at hotmail.com
Wed Jul 29 15:34:46 PDT 2009


Jarrett Billingsley Wrote:

> On Wed, Jul 29, 2009 at 6:20 PM, Dimitar
> Kolev<DimitarRosenovKolev at hotmail.com> wrote:
> > class plane
> > {
> >    bool fly = false;
> >    bool fly()
> >    {
> >         if (fly == false) return false;
> >
> >         // code for flying.
> >         // If it breaks for some reason
> >         return false;
> >
> >         // else return that everything is okay.
> >
> >         return true;
> >    }
> > }
> >
> > If I am missing something please say but is this not ambiguous now?
> > Is the function called or the property?
> 
> Neither.  The code won't compile, because unlike Java, you are not
> allowed to have both a field and a method of the same name.

Now you can be allowed.

And Andrei can keep the empty and no body will be insisting of isEmpty anymore.



More information about the Digitalmars-d mailing list