php OOP parent to child relationship

luster

New Member
\[code\]class base{ public $c = 'c'; public $sub = ''; function __construct(){ $this->sub = new sub(); }}class sub extends base{ public $ab = 'abs'; function __construct(){ $this->c = 'aas'; echo 'Test'; }}$a = new base();print_r($a);\[/code\]I would like to the sub class to edit the base vars \[code\]$this->c = 'blabla';\[/code\]how can i achieve this?
 
Back
Top