[thelist] how object oriented is php4
James Baster
evolt at thesinner.co.uk
Thu Mar 27 06:10:28 CST 2003
----- Original Message -----
From: "Tobyn Baugher" <toby at rsux.com>
To: <thelist at lists.evolt.org>
Sent: Thursday, March 27, 2003 7:25 AM
Subject: Re: [thelist] how object oriented is php4
> The features that I notice missing from it vs., say Python or Java:
>
> interfaces (Java)/multiple inheritance (Python)
> class variables
> differentiation between class and object methods
>
Static Variables and methods (Java) (is that the same thing as your last
two? I havent come across that terminology before.)
Private variables and methods (Java)
(If anyone would care to correct me, I'd be very grateful, I'm sorely
missing the latter.)
The Former I dont find so important, but the Latter is in terms of data
protection. It also helps enforcing proper interfaces. I've adopted a naming
convention of "private" before the name of each var and method I want to
keep private.
And rember PHP uses copy semantics not reference ones.
This means:
$a = new myObject;
$b = $a;
means you actually have two copies of the object, one pointed to from $b and
one pointed to from $a.
You need to use $b = &$a.
James.
More information about the thelist
mailing list