Hi
I'm dealing with a difficult OOP problem.
Maybe one of you could help me out. I'm getting a bit crazy...
For now I've got 2 classes.
class platformpage
{
member variables...
member methods...
function giveYourSelf($object)
{
$child_object = $object;
// do something with $child_object;
}
}
class mypage extends platformpage
{
member variables...
member methods...
}
$page = new mypage();
$page->giveYourSelf(&$page);
As you can see. I referer the instance object "page" to the parent class. This might seems a bit weird because mypage should be the same as platformpage, but I've got reasons to do so. ( It has to do with serializing and unserializing page objects and validate user inputs). Anyway, everytime I create an instance of the object $page, I'd have to do
$objectname->giveYourSelf(&$objectname);
I tried to implement this in the parent class (platformpage) constructor. So I doesn't have to write that line again. The purpose was to get the instanced object of a child into it's parent class. But if I write this line
$this->giveYourSelf(&this);
into the constructor of class platformpage. I don't get the child's object but the parent object, so "$this".
Is there anyway in PHP to get a an instanciated child object into it's parents?
I don't know this is a specific OOP problem but hopefully there's someway...
Thanx in advance
greetings
Tom