Is it impossible to pass static vars from child to parent class?

liunx

Guest
I need my parent class to work with data set as static vars in my child class -- but how can my parent class get at the data?

Example:

class MyParentClass
{
function show_data()
{
die(self::$special_data);
}
}

class MyChildClass
{
static $special_data = 'superman!';
}

// So I need to be able to do this:

$my_example = new MyChildClass;
$my_example->show_data();


But of course this fails because 'self' only refers to the parent object :-(

So how can I get static data from my child to my parent???Works for me, once I remembered that "class MyChildClass" "extends MyParentClass".
 
Back
Top