On Wed, 29 Jul 2009 18:33:29 -0400, Dimitar Kolev
<[email protected]> wrote:
I'm not getting your example...
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
{
Is this a property or a field? If it's a property, where is the code for
the property? If it's a field, then.... um I have no idea what you are
saying. Mark all fields with @?
bool @fly = false;
This is a function or a property?
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;
Huh? What are you doing here, there is no return value...
plane myPlane()
{
@myPlane = new plane();
}
bool fly()
{
if (@myPlane == null)
myPlane();
Does this use the field or the property of the plane? Or is there a field?
if (@mypl...@fly == false)
@mypl...@fly = true;
@myPlane.fly;
}
}
Still confused....
-Steve