enigmaPL
03-09-2007, 01:40 PM
i have two classes
class student{
private $information;
static function create()
{
//getting data from data_base
return new student;
}
}
and
class teacher{
private $information;
static function create()
{
//getting data from data_base
return new teacher;
}
}
they're very simmilar so I try to make parent class for there
class person
{
protected $information;
//getting data from data_base
static function create()
{
//getting data from data_base
SOMETHING;
}
}
but I don't know what I should write in place - SOMETHING, because it should depends on class. if I use student::create() in place SOMETHING should be return new student, and if I use teacher::create() in place SOMETHING should be return new teacher. Please help me.
--------------
sorry for mistakes, my English isn't good
class student{
private $information;
static function create()
{
//getting data from data_base
return new student;
}
}
and
class teacher{
private $information;
static function create()
{
//getting data from data_base
return new teacher;
}
}
they're very simmilar so I try to make parent class for there
class person
{
protected $information;
//getting data from data_base
static function create()
{
//getting data from data_base
SOMETHING;
}
}
but I don't know what I should write in place - SOMETHING, because it should depends on class. if I use student::create() in place SOMETHING should be return new student, and if I use teacher::create() in place SOMETHING should be return new teacher. Please help me.
--------------
sorry for mistakes, my English isn't good