How do you call a constructor for a parent class?
Posted by Raj
How do you call a constructor for a parent class?
parent::constructor($value)
Example:
class parentClass
{
function __construct()
{
}
}
class chClass extends parentClass
{
function __construct()
{
parent::__construct(); //call a constructor for a parent class
}
}
This entry was posted on October 4, 2009 at 12:14 pm, and is filed under
base class,
call,
call constructor from parent,
class Parent,
constructor,
Constructors,
OOP interview questions and answers,
parent class,
PHP,
PHP interview questions and answers,
Question
.You can leave a response, or trackback from your own site.