I would expect the following code to write "bar", but getFoo returns NULL.
What is the problem with that code, and how can i fix this?
<?php class A { protected $foo; public function getFoo() {return $this->foo;} public function setFoo($foo) {$this->foo = $foo;} } class B extends A{} $a = new A(); $a->setFoo("bar"); $b = new B(); echo $b->getFoo();