Yet a new properties proposal
Dimitar Kolev
DimitarRosenovKolev at hotmail.com
Wed Jul 29 15:33:29 PDT 2009
Dimitar Kolev Wrote:
Sorry I need an edit button. It is 12:30 a.m. here.
> Different example:
>
> 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;
> }
> }
>
> class pilot
> {
> if (myPlane.fly)
> myPlane.fly;
> }
>
> So this becomes:
>
> 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;
> }
> }
>
class pilot
{
plane @myPlane;
plane myPlane()
{
@myPlane = new plane();
}
bool fly()
{
if (@myPlane == null)
myPlane();
if (@myPlane at fly == false)
@myPlane at fly = true;
@myPlane.fly;
}
}
By the way I do not care if you are harsh or not. I just want this resolved.
More information about the Digitalmars-d
mailing list