Re: accessing magic parent set

From: Date: Wed, 22 Dec 2010 20:15:29 +0000
Subject: Re: accessing magic parent set
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-310236@lists.php.net to get a copy of this message
On Wed, Dec 22, 2010 at 6:35 AM, Alexandru Patranescu <drealecs@gmail.com>wrote: > Is this the only way to access the magic __set from the parent class: > > parent::__set($columnName, $value); > Other than referencing the parent class by name which is worse, yes. > I would have liked to work this way: > > parent::$columnName = $value; > The problem is that attributes are all attached to the object instance ($this). Only those that were defined by a class are associated with it. The "parent::<method>" construct is used only to locate the method overridden by the current method. There is a self, a static and a parent > Why is it only $this and not a $parent too? > I would guess the reasoning is that $this is a value (an object instance) whereas the others are not. David

« previous php.general (#310236) next »