Just Experts -- Need Help
Posted: Mon Aug 03, 2009 4:10 am
Hi all,
I have a problem with a superclass.
results:
class: Product -- function: render
class: User -- function: render
How to get child called function on parent class function. For example render instead of index etc.
I'll very happy every advise and every idea ?
Thanks.
Sorry for poor english.
I have a problem with a superclass.
Code: Select all
class Model {
public function render(){
echo '<br />class: '.get_class($this).' -- function: '.__FUNCTION__;
}
}
class Product extends Model {
public function show(){
$this->render();
}
}
class User extends Model {
public function index(){
$this->render();
}
}
$p = new Product();
$u = new User();
echo $p->show();
echo $u->index();
class: Product -- function: render
class: User -- function: render
How to get child called function on parent class function. For example render instead of index etc.
I'll very happy every advise and every idea ?
Thanks.
Sorry for poor english.