Abstract classes using values of instantiated objects

Just trying to get my head round some inheritance issues. When I extend an abstract class and overwrite a variables in my new class, then operations in the interface refer to the original value, not the overwritten one.


abstract class myinterface
{
	private $a;
	
	function myinterface()
	{
		var_dump($this->a);	//NULL
	}
}

class myinstance extends myinterface
{
	private $a = 1;
	function getA()
	{
		return $this->a;
	}
}

$a = new myinstance();
var_dump($a->getA());	//int(1)

Is this right? It doesn’t seem very useful. How can I define functions in the interface to access the extender’s values?
(testing on v5.3.1 but production on v5.1.6)

Ah. Thanks very much. Get it now.

That’s because you cannot override private variable. If you want to be able to override a variable, it has to be protected or public.