Tell me how to call a constructor for a parent class?
Answer Posted / Jayant Singh Rathore
In PHP, you cannot explicitly call the parent constructor. However, if you don't provide a constructor in your child class, PHP will automatically call the parent class's constructor by default. If you want to call the parent constructor explicitly, you can do so using the parent keyword inside the child class's constructor: public function __construct() { parent::__construct(); }
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers