Posted by mountain.dog on 03/21/07 15:13
Hi There,
I'm trying to understand inheriting properties object and I'm not
fully understanding the ways to accomplish this.
For example, I have a PHP array that is generate in "class a". I
would like to use this array with its values in "class b". When I
create a new instance of "class b" I get the array but none of the
values are present. Make sense? An explanation on how to accomplish
this would be great. A simplified example is below. Any help /
guidance would be greatly welcome. -- CH
class a {
public $one;
public function someMethod() {
$one = array("1");
}
}
class b extends class a {
public $one;
public $two
function someOtherMethod() {
print_r($this->one);
}
}
$display = new a;
$displayb = new b($a);
$displayb->someOtherMethod();
//outputs
Array ( [0] => )
Navigation:
[Reply to this message]
|