> -Original Message-
> From: Jay Blanchard [mailto:[EMAIL PROTECTED]
> Sent: Friday, July 11, 2008 1:51 PM
> To: Eric Butera; php php
> Subject: RE: [PHP] Question regarding OO
>
> [snip]
> I understand my error in thinking now.
>
> Apple can't extend
[snip]
I understand my error in thinking now.
Apple can't extend Tree.
Oak, Evergreen or Willow extend Tree.
I thank you all for helping me to understand.
[/snip]
By jove, I think he's got it!
Parking space could be a member variable of parking lot, that would make
sense.
--
PHP General Maili
-- Forwarded message --
From: Yeti <[EMAIL PROTECTED]>
Date: Fri, Jul 11, 2008 at 2:08 PM
Subject: Re: [PHP] Question regarding OO
To: Eric Butera <[EMAIL PROTECTED]>
I understand my error in thinking now.
Apple can't extend Tree.
Oak, Evergreen or Willow exte
On Fri, Jul 11, 2008 at 12:03 PM, Yeti <[EMAIL PROTECTED]> wrote:
>
> /*
>
> I have a question here regarding object orientation in PHP and any other
> language.
>
> Let's start with some hypothetical code:
>
> */
>
> // <--- 1st CLASS
>
> class ParkingLot {
>
> var size; // size in sq feet
>
> va
Corrected code example:
(too early in the morning to think)
In the above class definition, simply populate the $spaces array with
instances of the ParkingSpace class.
~Ted
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Object-oriented programming, with it's "class" and "object" approach,
is meant to model real life more closely than functional programming.
In, a "parking space" is physically inside a "parking lot", but a
parking space is not a subclass of a parking lot. It's not a variation
or mini park
On Fri, 2008-07-11 at 18:03 +0200, Yeti wrote:
>
> /*
>
> I have a question here regarding object orientation in PHP and any other
> language.
>
> Let's start with some hypothetical code:
>
> */
>
> // <--- 1st CLASS
>
> class ParkingLot {
>
> var size; // size in sq feet
>
> var max_numbe
size = $size; $this->max_number_of_cars = $max_cars;
}
};
cpark = new ParkingLot(5, 17);
// <--- 2nd CLASS
class ParkingSpace extends ParkingLot {
var ps_ID; // ID of the parking space ( 1 .. max_number_of_cars )
var occupied_by; // ID of the car on the parking space
var st_time; // Uni
8 matches
Mail list logo