hi,
i was wondering if there is any best practise known how one should
access the attributes of an object from the object itself.
i mean, it is a good practise to write getters and setters for the
attributes of an object to its interface. but is it common to modify the
attributes from the obje
ah i forgot e_all doesnt include e_strict. with error_reporting(-1 /
E_ALL | E_STRICT) i see the errors. so i think i am right that the use
of that special behavior of php is not a good idea. thank you guys!
Am 23.05.2011 00:32, schrieb Richard Quadling:
On 22 May 2011 22:44, Simon Hilz
ump($this) always outputs the same object (as
identified by id) but the "Behaviors" could only call the methods
defined in Car if they are defined public. if they are protected or
private they dont get called. no warning/error/whatever. just no call.
attributes are not accessible too
ourse I can call a method from it.
Sorry
Richard L. Buskirk
-Original Message-
From: Simon Hilz [mailto:simon.h...@gmx.de]
Sent: Sunday, May 22, 2011 11:56 AM
To: php-general@lists.php.net
Subject: Re: [PHP] context when calling non static method of class in a
static way
Richard,
yes!
new Foobar;
$oo->callBarStatic(); // returns only Foo
$oo->callBarPublic(); // returns Foobar
On May 22, 2011, at 10:17 AM, Simon Hilz wrote:
hi,
lets assume the following classes:
class Foo{
public function bar()
{
echo get_class($this);
}
}
class Foobar{
public f
Richard,
yes! at least my example works. i didn't test it any further; i doubt it
is intended that way.
Simon Hilz
Am 22.05.2011 16:42, schrieb ad...@buskirkgraphics.com:
Simon,
So without extending foo you can run bar in another class?
Richard L. Buskirk
-Original Me
new Foobar();
$obj->callBarStatic();
That means that the static call of bar() is executed in the context of
Foobar. Is this behavior deliberate? If so, it would open a great way of
object composition patterns. But only if it will be retained in future
versions :) (i've tested with 5.3.5)
7 matches
Mail list logo