Yet a new properties proposal

Jarrett Billingsley jarrett.billingsley at gmail.com
Wed Jul 29 15:28:20 PDT 2009


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.



More information about the Digitalmars-d mailing list